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