inheritance - Hibernate does not use discriminator in query with InheritanceType.JOINED -


i have following entities:

@entity @table(name = "employee") @inheritance(strategy = inheritancetype.joined) @discriminatorcolumn(name="type")  public class employee {}  @entity @table(name = "regular_employee") @primarykeyjoincolumn(name = "id") @discriminatorvalue("r") public class regularemployee extends employee{} 

the problem hibernate not use discriminator value in queries.

select     employee0_.id id1_1_,     employee0_.name name2_1_,     employee0_.type type3_1_,     employee0_1_.pay_per_hour pay_per_1_0_,     case          when employee0_1_.id not null 1          when employee0_.id not null 0      end clazz_      employee employee0_  left outer join     regular_employee employee0_1_          on employee0_.id=employee0_1_.id  

shouldn't hibernate use discriminator value in "left jouter join" section? like:

left outer join     regular_employee employee0_1_          on employee0_.type='r' , employee0_.id=employee0_1_.id 

i'm guessing bring boost in performance.

thanks, tekin.

the discriminator value not necessary fetch required data when using joined inheritance strategy , left joins. jpa specification doesn't enforce use of discriminator in such case - explained in answer hibernate 4: persisting inheritancetype.joined discriminator column values.

that said, hibernate team seems pretty proud don't need use discriminator value can observed comments hhh-6911.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -