Hi,
i have two tables:
t1(a,b,c)
t2(c,d)
in Relation 1 to many: for each data record from t1 is many records in t2
c in t1 is foreign key.
How i can map all records from t2 (for example for c = 555) to List in Class t11?
case class t1(a: Int, b: String, c: Int, d_list: List[Int])
object t11 extends Table[t1]("t1"){
def a = column[Int]("a")
def b = column[String]("b")
def c = column[Int]("c")
//need: all records from t2 as List for this record from t1 AUTOMATIC
def d_list = List[t2.d]
// i think maybe with def mapped, but how !?
def t2_d = foreignKey("C_FK", c, analysis_names)(_.c)
}
case class t2(c: Int, d: Int)
object t22 extends Table[t2]("t2"){
def c = column[Int]("c")
def d = column[Int]("d")
}
have idea!?
Sorry for my english.
Alles noch mal auf deutsch:
Ich habe die zwei Tabellen,die in der Beziehung 1 zu n stehen. Ich will, die Klasse definieren so, dass alle Datensätze von der Tabelle t2, die zum Eintrag von der Tabelle t1 gehören, als Liste in der Klasse t1 automatisch geliefert werden. Ich glaube, dass es irgenwie mit <def mapped> gehen muss, aber ich weiss es nicht, wie ich dass defeniere.
Hat jemand Ideen!?
best regards / freundliche Grüße
Oleg