Just an update ...
I did manage to get maven to pull down 1.1-M5, not sure what was up
with it before, but it worked in the morning.
I couldn't resolve the class MappedOneToMany, or Owned, even though I
can see them in the lift-mapper-1.1-M5.jar . Used the import import
net.liftweb.mapper._
Oh
How do you want the database to store it?
-
benb...@primrose.org.uk wrote:
Hi,
So I have an object which gets persisted via the normal way .. ie :
class Person extends LongKeyedMapper[Person] with IdPK {
object name extends MappedPoliteString(this,
But I cannot for the life of me work out of to store a list of objects
What do you expect the underlying type in the database table to be?
Normally this would be done with a separate table with a foreign key
(MappedLongForeignKey) back to the users table.
-harryh
If I was in Java/Hibernate mode, I guess I'd tag it as one-to-many and
have a Skill object, which maps back to the Person object via a
key ... just not sure how to do that with Lift's OR mapper. I keep
having mental blocks when it comes to lift scala :(
I guess if I was doing it in Java, I
I'd suggest a one to many relationship with a foreign key. For
something off the top of my head (no guarantees this'll actually
work):
class Person extends LongKeyedMapper[Person] with IdPK {
def getSingleton = Person
object skills extends MappedOneToMany(Skills, Skills.person) with
Thanks for the reply, will have a go at that.
Cheers,
Ben
--~--~-~--~~~---~--~~
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,
ben b...@primrose.org.uk writes:
If I was in Java/Hibernate mode, I guess I'd tag it as one-to-many and
have a Skill object, which maps back to the Person object via a
key ... just not sure how to do that with Lift's OR mapper. I keep
having mental blocks when it comes to lift scala :(
harryh har...@gmail.com writes:
But I cannot for the life of me work out of to store a list of objects
What do you expect the underlying type in the database table to be?
Normally this would be done with a separate table with a foreign key
(MappedLongForeignKey) back to the users table.
I
Jeppe : Yes, thats what I was after. It seems like a lot of work to
map a list of objects (compared to other ORMs), but I'm willing to
give it a go.
Shame really, as I've got used to writing less code lately with
Scala !
Problem is, LongMappedForeignMapper seems to be only from Lift 1.1 ...
but
You can do this with Mapper using a ManyToMany relationship. To make
sure we're talking about the same thing, let me try and explain.
With ManyToMany, you can do both Person.find(By(Person.name,
name)).map(_.skills) as well as Skills.find(By(Skill.description,
description)).map(_.people) and get
That is exactly what I designed OneToMany / MappedOneToMany for -- to be a view
on a one-to-many relationship as a collection. I'm sure it could be optimized
better but it works (at least for me :) ). If the wiki article isn't clear
enough let me know.
MappedOneTwoMany does not extend
ben b...@primrose.org.uk writes:
Jeppe : Yes, thats what I was after. It seems like a lot of work to
map a list of objects (compared to other ORMs), but I'm willing to
give it a go.
Shame really, as I've got used to writing less code lately with
Scala !
Problem is, LongMappedForeignMapper
12 matches
Mail list logo