ZvL
ZvL

Reputation: 803

Squeryl Many to Many: compositeKey(field1, field2) doesn't exist

I'm learning Scala (2.11) and the Play Framework, and i'm trying to implement a Many to Many relation between Person and Skill with Squeryl (0.9.5-7). Multiple Persons can share Skills, and a Person can have many Skills.

The Squeryl docs tell me to do this:

class PersonToSkill(val personId: Long, val skillId: Long) extends KeyedEntity[CompositeKey2[Long,Long]] {
  def id = compositeKey(personId, skillId)
}

But the compiler tells me this:

not found: value compositeKey
[error]   def id = compositeKey(personId, skillId)
[error]            ^
[error] one error found
[error] (compile:compile) Compilation failed

Also, i cannot find compositeKey(fieldId, fieldId) in the docs. I have no idea where it it originates from.. I'm hoping someone can help me solve my problem, or at least explain me where to look for a solution. Thanks!

Upvotes: 0

Views: 135

Answers (1)

jcern
jcern

Reputation: 7848

You can find compositeKey located within org.squery.dsl.QueryDsl

You'll want to make sure you import org.squeryl.PrimitiveTypeMode._ which extends QueryDsl. That should resolve the error you are receiving.

Upvotes: 1

Related Questions