Hi,

I'm trying to learn some Scala and Lift, and I'm currently playing
with the Lift mapper. I have however stumbled upon a problem for which
I don't seem to be able to find answer from the examples or by using
Google. How do you create one-to-many mapping with lift mapper?

I have something like

class Parent extends KeyedMapper[Long, Parent] {
  def getSingleton = Parent
  def primaryKeyField = id

  object id extends MappedLongIndex(this)
}

class Child extends KeyedMapper[Long, Child] {
  def getSingleton = Child
  def primaryKeyField = id

  object id extends MappedLongIndex(this)

  object parent extends MappedLongForeignKey(this, Parent)
}

What do I need to do so that I could do something like

parent.children.map(...)

Only way I have figured out is to create function like one below in
the Parent class. That will only solve problem of finding and updating
them, not adding, deleting or so.

  def children = Child.findAll(By(Child.parent, this.id))

There probably is a correct way to do this, but at least I couldn't
find it. Any help appreciated.

Thanks beforehand,
  Juha

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to