-->
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: Discriminator column name ignored when specified in orm.xml
PostPosted: Tue Feb 10, 2009 3:36 pm 
Newbie

Joined: Tue Oct 24, 2006 11:43 pm
Posts: 5
Hibernate version:
3.2.4.sp1

Hibernate annotations/em version:
3.2.1.ga

Mapping documents:
Most JPA mapping are annotated on the class itself except the @Table and @Inheritance is put in orm.xml.

An entity at the root of the inheritance heirarchy suing table per heirarchy approach -
Code:
<entity class="com.domain.A" name="A">
    <table name="A"/> 
    <inheritance strategy="SINGLE_TABLE"/> 
    <discriminator-column name="DISCRIMINATOR" discriminator-type="STRING"/>
</entity> 


An entity part of table per heirarchy inheritance but not the root parent. Root parent is A
Code:
<entity class="com.domain.B" name="B"></entity> 


An entity not participating in Table per Heirarchy and using Joined Subclass.
Code:
<entity class="com.domain.C" name="C">
    <table name="C"/> 
    <inheritance strategy="JOINED"/>
</entity> 


exception that occurs:
ORA SQL Grammar exception.

Name and version of the database you are using:
Oracle 10g

The generated SQL (show_sql=true):
Not using hibernates SQL generation, but have checked that the databse has the column name correctly set to DISCRIMINATOR.

Debug level Hibernate log excerpt:

Code:
insert
    into
        A
        (ATTR, CREATEDBY, CREATIONDATE, LASTMODIFICATIONDATE, LASTMODIFIEDBY, uuid, VERSION, DTYPE, ID)
    values
        (?, ?, ?, ?, ?, ?, ?, 'A', ?)
02:04:03,494 WARN  [JDBCExceptionReporter] SQL Error: 904, SQLState: 42000
02:04:03,494 ERROR [JDBCExceptionReporter] ORA-00904: "DTYPE": invalid identifier




So, it’s trying to use DTYPE (hibernate’s default) as the discriminator column rather than DISCRIMINATOR.
Any idea why its ignoring the column specified in the orm.xml and using the hibernate default? When I change the SQL to use DTYPE rather than DISCRIMINATOR, all works fine. Also the entities that dont use table per heirarchy but rather joined subclass work fine.

So is there some wrong syntax in my orm.xml?
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 10, 2009 7:42 pm 
Newbie

Joined: Tue Oct 24, 2006 11:43 pm
Posts: 5
I think I am possibly bitten by this
http://opensource.atlassian.com/project ... se/EJB-259
I guess one has to upgrade to a newer hibernate em.


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