Please take a look at the MegaProtoUser and MegaMetaProtoUser code for examples of how to create traits that can be mixed into classes.
Does that help? On Thu, Feb 4, 2010 at 9:58 AM, Mads Hartmann Jensen <[email protected]>wrote: > hello Jeppe, > > In my project I've got the following three models: A discovery, a Scientist > and a lab. The Discovery has been invented by someone, this is either a > single scientist or sometimes a lab - This is easily done through > inheritance (would create a superclass named source) but I'm not sure how to > do this so it maps nicely to the database. > > Scientist and Lab only share one attribute so what I'm most interested in > is to be able express that a Discovery has s source that can be either a lab > or scientist :) > > Hope this explains my problem more clearly, thanks for the help > > Mads Hartmann > > Sent from my iPhone > > > On 04/02/2010, at 18.17, Jeppe Nejsum Madsen <[email protected]> wrote: > > Mads Hartmann <[email protected]> writes: >> >> Hello Everyone, >>> >>> I'm currently trying to figure out how to map objects with inheritance >>> using the Mapper framework. I've got a Lab and a Scientist who inherit >>> from Source. >>> >>> As I understand there's no direct way to do inheritance using the >>> Mapper framework so I'm trying to figure out how to implement 'Single >>> Table Inheritance'. >>> >>> Right now I'm trying to create a single trait (Source) for the values >>> that they share called BaseSource and my idea is to mix it in both Lab >>> and Scientist. I would then define the table name of both scientist >>> and lab to be the same - I think this would work but what I'm not sure >>> of is the following: >>> >>> - If both Scientist and Lab mixes in the IdPK trait and use the same >>> table, will the id still be unique? >>> - A Discovery has a source, how do i create MappedLongForeignKey to >>> the table they share (lab, scientist)? >>> >>> I hope you'll be able to help me out :) >>> >> >> I can't say I follow the above :-) Do you want to share tables, code or >> both? Maybe list the table structure and explain how you would like to >> map it.... >> >> /Jeppe >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Lift" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<liftweb%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/liftweb?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<liftweb%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected]. 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.
