Frage

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?

War es hilfreich?

Lösung

Since you are probably using anorm, you have to do it yourself using the powers of sql, since anorm is not an orm

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top