Reputation: 2458
My question is fairly easy.
I have to model classes which are have a many-to-many relationship.
case class A(
id: Pk[Long],
name: String
)
case class B(
id: Pk[Long],
name: String
)
In play with java you can code this fairly easy, because of the Hibernate framework:
@ManyToMany(cascade=CascadeType.PERSIST)
public Set<A> allAs;
What is now the proper way in Play with Scala to add a many to many relationship between these two classes?
Do I have to model the helper table myself like this:
case class AToB(
a_id: Long,
b_id: Long
)
Or is there a better, easier way without the (unnecessary) code for the helper table?
Upvotes: 3
Views: 883
Reputation: 336
Since you are probably using anorm, you have to do it yourself using the powers of sql, since anorm is not an orm
Upvotes: 6