-->
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: Repeated Discriminator column breaks paging in Oracle
PostPosted: Sun Apr 17, 2005 5:46 pm 
Newbie

Joined: Wed Dec 01, 2004 12:44 am
Posts: 3
When mapping a subclass hierarchy using the dicriminator-column and repeating the discriminator as a key property, the SQL generated for paging queries to an Oracle DB is invalid.

The reason seems to be that the paging operation wraps the query in a subselect to add the rownumber used for paging. The original query contains the discriminator twice:

Code:
SELECT id as id, type as type, type as type from SUPPLIER


Using this statement in a subselect causes Oracle to throw an "Ambiguous column name" error.

Possible fix:

in the EntityPersister constructor
Code:
public EntityPersister(PersistentClass model, SessionFactoryImplementor factory)
change the generated discriminator alias (line 712) from:

Code:
discriminatorAlias = column.getAlias();


to

Code:
discriminatorAlias = column.getAlias() + "__";


This will cause the discriminator name to not overlap with the name of the key property column in the SQL code.


Hibernate version: 2.1.8

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


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.