• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate table per class hirearchy discriminator value with query

 
srini carry
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I it possible to specify the discriminator value with sql query ?

I want to implement hibernate inheritace with table per class hirearchy for this i have to create a discriminator colum and the examples i saw all show a hard coded value , instead i want to get the discriminator value with a query is it possible?



mine is a workflow application , i start the workflow for several entities , i need a table which ,maps the workflow PK to entity PK , i can do this with multiple mapping tables but i want to have just one mapping table , for this i want to create a tbale called entity_type

(PK)Entity_type_id, (String)entiy_name

next i need a worklfow mapping table
(PK)worklfow_mapping _id,(FK)entity_type_id, (Number)entity_id



with this data model i want to acheieve tbale per class hirearcy for workflow mapping table and here i need a query to get the entity_type_id the discriminator value I want to provide is select entity_type_id from entity_types where entity_name="Student"
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

with this data model i want to acheieve tbale per class hirearcy for workflow mapping table and here i need a query to get the entity_type_id the discriminator value I want to provide is select entity_type_id from entity_types where entity_name="Student"

Which of these is your discriminator, the entity_type_id or the entity_name?
 
miro swartch
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

entity_type_id in worklow mapping table , its a foreign key from entity_types .

Paul Sturrock wrote:

with this data model i want to acheieve tbale per class hirearcy for workflow mapping table and here i need a query to get the entity_type_id the discriminator value I want to provide is select entity_type_id from entity_types where entity_name="Student"

Which of these is your discriminator, the entity_type_id or the entity_name?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic