Lift doesn't really support this directly in Mapper, although you could
write a single class and use a discriminator value field. If there's not a
relational need for both types to have a common superclass it would probably
be simpler to just build two distinct classes and have them sit in different
tables. IIRC, you *could* have a common base class with common fields for
both types and just override the dbTableName def on the Meta object for
each. If you're using JPA you can easily do this with an inheritance
mapping.

Derek

On Fri, Oct 2, 2009 at 8:55 PM, Dave <davidtgoldb...@gmail.com> wrote:

>
>
> Hi all-
>
> I posted this on stackoverflow but I figure its probably relevant here
> too.  I checked out the post with David and Steve Yen corresponding
> but I am still at a loss and am curious if any progress has been made
> in this direction.  So, here goes.  I am creating a website which will
> need two types of users: students and providers. In a traditional java
> setting I would create a user class (or interface) and then create two
> classes which inherited from the user. Is this the best course in
> scala too, using the "extends" and "with" modifiers? If that is indeed
> the best way (which I suspect it is), what the best way to map this in
> the DB? Would it be best to keep a "type" column and then have it set
> to one or the other?  Etc.
>
> The second question is how to work with the view. The display will be
> very different depending on which type of user one is and so I figure
> there will be some serious routing logic involved or at least logic
> built into snippets in the view.
>
> I guess the overarching question is: Is there a "preferred" way to go
> about doing this (like a recipe in rails or some such), or am I kind
> of out on my own?
>
> Thanks
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to