-->
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: identifier of instance of class was altered from 7 to 79
PostPosted: Thu Mar 31, 2011 7:19 am 
Newbie

Joined: Thu Mar 31, 2011 6:20 am
Posts: 1
Hi,

I am getting below exception inconsistently when we trying to persist multiple records at a single transaction.

Caused by: org.hibernate.HibernateException: identifier of an instance of Test was altered from 7 to 79
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:85)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1185)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1261)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)

I have pasted the hbm files below. Can anyone please help me to get out of this issue.

1.Test.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="Test"
abstract="true">

<!--Id-->
<id name="testId" column="TEST_ID" type="long">
<generator class="native" />
</id>

<!--Properties-->
<property column="PARENT" name="parentName" type="string" />
</class>
</hibernate-mapping>

2. SubTest.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<union-subclass name="SubTest"
extends="Test"
table="Test" >

<!--Mapping b/w other tables-->
<set name="testSet" inverse="true" cascade="save-update, delete-orphan">
<key column="TEST_ID" />
<one-to-many class="TestData" />
</set>

</union-subclass>
</hibernate-mapping>

3. ParentTestData.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


<hibernate-mapping>

<class name="ParentTestData"
abstract="true">

<!--Id-->
<id name="parentTestId" column="PATRENT_VALUE_ID" type="long">
<generator class="native"/>
</id>

<!--Properties-->
<property name="keyString" column="KEY_STRING" type="string"/>

</class>
</hibernate-mapping>

4. TestData.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


<hibernate-mapping>

<union-subclass name="TestData"
extends="ParentTestData"
table="TEST_VALUE">


<!--Mapping b/w other tables-->
<many-to-one name="myTest" column="TEST_ID" not-null="true"/>

</union-subclass>
</hibernate-mapping>

Regards,
Riyas[code][/code]


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.