-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: many-to-one discriminator
PostPosted: Wed Mar 25, 2009 11:38 pm 
Newbie

Joined: Tue Mar 24, 2009 3:47 am
Posts: 9
I want to map a many-to-one relationship as being the discriminator in an inheritance structure.

So basically:

employee_type(int) references EMPLOYEE_TYPE(table),employee_type(id),employee_type_name(string).

So I want to reference the string value in the EMPLOYEE_TYPE table.

<discriminator> only appears to have a column attribute for referencing a single value. Is there a way to get it to reference a many to one relationship resolution of a value.

Cheers in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 26, 2009 3:26 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
You can do this by using formula in the discriminator.

<discriminator formula="(select et.employee_type_name from EMPLOYEE_TYPE et where et.employee_type=employee_type)" type="java.lang.String" />

Then you can have an additional many-to-one field to EmployeeType using the employee_type column. And then it would be ur responsibility to set a proper EmployeeType in that field.

_________________
Regards,
Litty Preeth


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.