-->
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: Collisions between identifier and property aliases
PostPosted: Mon Jun 06, 2005 3:52 pm 
Newbie

Joined: Sun Apr 17, 2005 1:56 am
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

3.0.5

Mapping documents:
<class name="POJO" table="eg">
<composite-id>
<key-many-to-one name="bar" column="foo_bar" class="Bar" />
</composite-id>
<property name="bas" column="foo_bas" type="string"/>
</class>
Code between sessionFactory.openSession() and session.close():
n/a
Full stack trace of any exception that occurs:
None
Name and version of the database you are using:
MySql
The generated SQL (show_sql=true):
Not available
Debug level Hibernate log excerpt:


(I need to backport from my application code to the example stuff, so this is a guess)

I've noticed that if key and property column names are similar (specifically, the portion before an underscore), and if I get unlucky with the order that a table's unique integer is assigned, that they can have the same alias in the identifier and property arrays, generating incorrect (although valid) SQL.

I'm able to fix this inelegantly in two different ways: by loading a hibernate mapping twice (pushing the table's counter up) or in a somewhat better way by quoting the column names.

If necessary, I'll do some more work to provide a sufficiently business-logic free version of the mapping.

Ranjan


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.