thanks for the reply but im not sure if your solution will work..
Lets say we do what you say and have a User base class and then a producer
and consumer subclass. I assume the @discriminating column would be the
role_id in the user_role table (although how you specify this im not so
sure). But what happens when a user (i.e. one row in the app_user table)
has many roles associated with him ? For example the user could have the
role ADMIN and PRODCUCER, what object would the row get mapped to then ? And
would this stuff up the whole acegi rbac mechanism thats there already in
appfuse 2 when we tinker with it?
thanks
p.s. I would be very interested in learning the annotations to use for your
solution
DNewfield wrote:
>
> emmettwalsh wrote:
>> I have a relationship between two tables which Im not sure sure is
>> actually
>> possible to model with hibernate or not.
>
> Sounds to me like you have two classes that should extend User (using a
> single table for the entire class hierarchy). You can have a
> one-to-many relationship between each class and the ScheduleEntry class
> (each Schedule Entry is limited to at most one producer and one
> scheduler according to your description), and implement
> getScheduleEntries() differently in each of them to return different
> types of relationships.
>
> The corner case that will cause you trouble is if you ever decide that a
> producer should be able to schedule an appointment with another
> producer, as that is excluded from your description.
>
>> I also have the following additional requirements:
>> If I am a 'producer' user and I get deleted, my associated
>> scheduleentries
>> should get deleted aswell
>> If I am a 'consumer' user and I get deleted, my associated
>> scheduleentries
>> should get deleted aswell
>
> These are just the cascade settings.
>
>> In the object model, if a scheduleentry gets deleted I want its reference
>> in
>> the lists held by the producer user and the customer user to get deleted
>> also, so that they are not hanging on to stale lists.
>
> That you have to do yourself, but should be as simple as putting the
> following in your delete method:
> if (se != null) {
> if (se.getProvider() != null) {
> Provider p = se.getProvider();
> List<ScheduleEntry> appointmentBook = p.getScheduleEntries();
> if (appointmentBook != null) {
> appointmentBook.remove(se);
> p.setScheduleEntries(appointmentBook);
> }
> }
> if (se.getConsumer() != null) {
> Consumer c = se.getProvider();
> List<ScheduleEntry> appointments = c.getScheduleEntries();
> if (appointments != null) {
> appointments.remove(se);
> c.setScheduleEntries(appointments);
> }
> }
> }
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Can-Hibernate-map-this---tp14992855s2369p15027536.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]