Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3498360
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:28:53+00:00 2026-05-18T12:28:53+00:00

I am testing(trying) squeryl’s relations modeling feature class Foo(val id: Long, val foBar: Long)

  • 0

I am testing(trying) squeryl’s relations modeling feature

class Foo(val id: Long, val foBar: Long) extends KeyedEntity[Long]{
    //Many Foo's can have one Bar.
    lazy val fbar: ManyToOne[Bar] = myschema.barToFoo.right(this)
}
class Bar(val id: Long) extends KeyedEntity[Long]{
    //One Bar can be assigned to many Foo's.
    lazy val bfoo: OneToMany[Foo] = myschema.barToFoo.left(this)
}

object myschema extends Schema{
    val bars= table[Bar]
    val foo= table[Foo]
    val barToFoo =
        oneToManyRelation(Bar, Foo).
        via((b,f) => b.id === f.foBar)
    /** Find all Bars that are assigned to at least one foo.*/
    def findBars() ={
        from(bars)((b) => where(b.bfoo.size gt 0) select(b))
    }
}

If I try to test that code with the following code:

test("Test findBars"){
  using(jdbcSession){
      val mybars = telemetria.findBars
      for{i <- mybars}{
          println(i.id)
          i.id should equal(1)
      }
  } 
}

And I get the following error:

java.util.NoSuchElementException: None.get

The exception is being thrown from the body of findBars. I can’t think about anything that could be causing such problem. Have anyone run into a similar situation?

Since Daniel pointed out that it could be a compiling problem, I am appending the build.properties and a property from project.scala

project.organization=org.simepar
project.name=scalatra-sbt-prototype
sbt.version=0.7.4
project.version=2.0.0.M2
def.scala.version=2.8.1
build.scala.versions=2.8.1
project.initialize=false

;

val squeryl = "org.squeryl" % "squeryl_2.8.0" % "0.9.4-RC3"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:28:53+00:00Added an answer on May 18, 2026 at 12:28 pm

    The problem lies in the where clause :
    where(b.bfoo.size gt 0)

    b.bfoo.size causes an implicit conversion of the bfoo Query to an Iterable
    (b.bfoo is a OneToMany[Foo] which is also a Query[Foo], calling
    .size on it cause the evaluation of the query).

    You need to rewrite “findBars” like this :

    def findBars =
    
      from(bars)(b =>
        where(b.id in
                  from(foo)(f=> where(f.foBar === b.id) select(f.foBar))
        )
        select(b)
      )
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Duplicate : https://stackoverflow.com/questions/135651/learning-unit-testing I'm trying to develop some software for my research group to
I am trying to automate functional testing of a server using a realistic frequency
I am trying to implement performance testing on ActiveMQ, so have setup a basic
While trying to answer a question in the vicinity ' Unit Testing WPF Bindings
I am trying to perform some unit testing on the iphone but for some
I'm trying to incorporate some JavaScript unit testing into my automated build process. Currently
I'm trying to be better about unit testing my code, but right now I'm
I've been trying to implement unit testing and currently have some code that does
We are trying to look at optimizing our localization testing. Our QA group had
I'm trying to get started with unit testing in Python and I was wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.