Hi folks,
I've been using Hibernate for several months now and I'm usually able to get by seemingly obscure errors and I've learned some of the trade offs with Hibernate. But this one is completely mistery:
session.createCriteria(prototype.getClass()).add(Example.create(prototype)).list();
gives me:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with th
e session:
'prototype' in the above call is a simple POJO with no associations whatsoever. Here is its config:
<class table="PORTT_MDC_I18N_RESOURCES" name="gov.miamidade.i18n.MessageResource">
<id name="id" column="MDC_I18N_ID">
<generator class="sequence">
<param name="sequence">PORTSQ_HIBERNATE_SEQUENCE</param>
</generator>
</id>
<property name="key" column="MDC_I18N_KEY" />
<property name="bundle" column="MDC_I18N_BUNDLE" />
<property name="language" column="MDC_I18N_LANGUAGE" />
<property name="text" column="MDC_I18N_TEXT" type="text"/>
</class>
I understand that I might already have loaded some of the objects matching my prototype, but why do I need to worry about that when making a query? In all my code I pay special attention to do merge/save/update when appropriate, but this is a simply query that's supposed to be handled properly by Hibernate.
Any idea?
Thanks a lot in advance!
Borislav
PS I'm using Hibernate version 3.1.3, March 20, 2006
|