-->
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.  [ 1 post ] 
Author Message
 Post subject: Joined-subclass useability margins
PostPosted: Wed Nov 12, 2008 1:30 pm 
Newbie

Joined: Fri Nov 07, 2008 7:04 am
Posts: 1
In our legacy system we have 4 level hierarchy of objects with dozen of entities. In root entity we generate id and use hierarchically organized integer discriminator. Application level based on Oracle editable view with instead-of triggers.

The question is how applicable joined subclass approach without discriminator for our data. I think joining altogether underlying tables as in your Animal example is rather expensive.

Subclass approach with discriminator doesn't accept more then 2 levels of hierarchy.

What is the best practice in our case?

Hibernate version: 3.2

Mapping documents:Animal.hbm.xml from standard package test

The generated SQL (show_sql=true):

Generated by from Animal query

Code:
select
animal0_.id as id163_,
animal0_.description as descript2_163_,
animal0_.body_weight as body3_163_,
animal0_.mother_id as mother4_163_,
animal0_.father_id as father5_163_,
animal0_.zoo_id as zoo6_163_,
animal0_.serialNumber as serialNu7_163_,
animal0_1_.bodyTemperature as bodyTemp2_164_,
animal0_3_.pregnant as pregnant166_,
animal0_3_.birthdate as birthdate166_,
animal0_4_.owner as owner167_,
animal0_7_.name_first as name2_170_,
animal0_7_.name_initial as name3_170_,
animal0_7_.name_last as name4_170_,
animal0_7_.nickName as nickName170_,
animal0_7_.height as height170_,
animal0_7_.intValue as intValue170_,
animal0_7_.floatValue as floatValue170_,
animal0_7_.bigDecimalValue as bigDecim9_170_,
animal0_7_.bigIntegerValue as bigInte10_170_,
case
when animal0_2_.reptile is not null then 2
when animal0_5_.mammal is not null then 5
when animal0_6_.mammal is not null then 6
when animal0_4_.mammal is not null then 4
when animal0_7_.mammal is not null then 7
when animal0_1_.animal is not null then 1
when animal0_3_.animal is not null then 3
when animal0_.id is not null then 0 end as clazz_
from Animal animal0_
left outer join Reptile animal0_1_ on animal0_.id=animal0_1_.animal
left outer join Lizard animal0_2_ on animal0_.id=animal0_2_.reptile
left outer join Mammal animal0_3_ on animal0_.id=animal0_3_.animal
left outer join DomesticAnimal animal0_4_ on animal0_.id=animal0_4_.mammal
left outer join Cat animal0_5_ on animal0_.id=animal0_5_.mammal
left outer join Dog animal0_6_ on animal0_.id=animal0_6_.mammal
left outer join Human animal0_7_ on animal0_.id=animal0_7_.mammal]


_________________
Billy


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

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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.