-->
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: Assertion failure occured with Hibernate 3 saving objects
PostPosted: Fri Jul 01, 2005 10:34 am 
Regular
Regular

Joined: Thu Sep 04, 2003 10:43 am
Posts: 61
My problem is the exception below.

Hibernate version:
3.0.5

Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 1.1//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="testHib3.tstDACmain" table="tst_main">
<id column="id" name="id" type="long">
<generator class="native"></generator>
</id>
<property column="des" length="50" name="des" not-null="false" type="string"/>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Session hibSession = sf.openSession();
tstDACmain m = (tstDACmain)hibSession.load( tstDACmain.class, new Long(1) );
m.setId( null );
hibSession.evict( m);
hibSession.saveOrUpdate( m );
hibSession.flush();

Full stack trace of any exception that occurs:

SEVERE: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)

org.hibernate.AssertionFailure: null identifier
at org.hibernate.engine.EntityKey.<init>(EntityKey.java:33)
at org.hibernate.event.def.DefaultEvictEventListener.onEvict(DefaultEvictEventListener.java:51)
at org.hibernate.impl.SessionImpl.evict(SessionImpl.java:702)
at testHib3.starter.go(starter.java:69)
at testHib3.starter.main(starter.java:22)
org.hibernate.AssertionFailure: null identifier
at org.hibernate.engine.EntityKey.<init>(EntityKey.java:33)
at org.hibernate.event.def.DefaultEvictEventListener.onEvict(DefaultEvictEventListener.java:51)
at org.hibernate.impl.SessionImpl.evict(SessionImpl.java:702)
at testHib3.starter.go(starter.java:69)
at testHib3.starter.main(starter.java:22)

Name and version of the database you are using:
SQL Server 2000 SP2

The generated SQL (show_sql=true):
Hibernate: select tstdacmain0_.id as id0_, tstdacmain0_.des as des0_0_ from tst_main tstdacmain0_ where tstdacmain0_.id=?



Notice that if you change the code like this:

From:
tstDACmain m = (tstDACmain)hibSession.load( tstDACmain.class, new Long(1) );

To:
tstDACmain m = new tstDACmain();
hibSession.load( m, new Long(1) );

then it works perfectly. No error occurs, and the object is saved in the database.

I did not have this error on Hibernate 2.1.8.

Should I put into JIRA?
Regards
Alessandro Rizzi


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.