Im still a bit confused ..but

if I understand , i think you are telling me to put a new column in the base
class and use this as the discriminating column. 

which leads me to this question-  But if I do this, then what would the
value be in it for say a user that is for example an ADMIN role and a
PRODUCER role ? 

and if im right your answer would be something like - the discriminating
column is purely for creating the right objects with the extra behaviour
needed. So if in fact a user did have an admin and a producer role, then the
discriminating column would just have a value of 'PRODUCER', and the object
created would be a Resource (as this has needs some extra behaviour at
times). The user would still hold its associated list of roles (i.e. admin
and producer), and work as a normal user object, but has the extra behavior
needed for a producer.

or have I got it totally wrong ?

thanks

If I use SINGLE table inheritance with the appfuse User class as the base
class, how do I specify the users role name as the discriminating column,
when the user can have a few roles. Or do I need to have a new column in the
user table ? If I do how do I

e.g. in base class

@Entity 
@Table(name="app_user") 
@Inheritance(strategy=InheritanceType.SINGLE_TABLE) 
@DiscriminatorColumn(name="role.name",
                discriminatorType=DiscriminatorType.STRING) 





DNewfield wrote:
> 
> emmettwalsh wrote:
>> 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).
> 
> There is probably going to be a correlation between a user's concrete 
> class being producer or consumer and the roles they have in the role 
> table, but the latter is not managed by the former -- i.e.: If you want 
> to define roles to correlate with these different types of user, you'll 
> still need those entries in the user_role table in addition to the 
> discriminator column in the user table that lets us know which type of 
> concrete Java object to create.
> 
>> 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?
> 
> A single user can still have all the roles you want, but according to 
> the use case you described it is still impossible for a user to be both 
> a producer and a consumer.  If you want a single user to be able to be 
> both, you can't expect the single getScheduleEntries() method you 
> described earlier to be able to behave the way you specified.  If you 
> don't mind having two different methods, then you could do with a single 
> user type.
> 
>> p.s. I would be very interested in learning the annotations to use for
>> your
>> solution
> 
> I still use xdoclet tags, so I can't help here.
> 
> -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---tp14992855s2369p15064143.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]

Reply via email to