From: <no...@at...> - 2005-07-26 17:14:55
|
The following comment has been added to this issue: Author: Alessandro Rizzi Created: Tue, 26 Jul 2005 12:14 PM Body: Sorry but I do not understand. Do you mean that now I will always have the IllegalArgumentException? Or only in the case reported above? In both cases, why? Why it works right in Hibernate 2.1.8, and throws the exception now? And, most important: why 1 overload of session.load() works and the other one cause an exception? (While in 2.1.8 both works right). Is there any mistake in my code? Reagards Alessandro Rizzi --------------------------------------------------------------------- View this comment: http://opensource.atlassian.com/projects/hibernate/browse/HHH-779?page=comments#action_19065 --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-779 Here is an overview of the issue: --------------------------------------------------------------------- Key: HHH-779 Summary: Assertion failure occured with Hibernate 3 saving objects Type: Bug Status: Closed Priority: Major Resolution: FIXED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate3 Components: core Fix Fors: 3.1 beta 2 Versions: 3.0.5 Assignee: Reporter: Alessandro Rizzi Created: Fri, 22 Jul 2005 9:56 AM Updated: Tue, 26 Jul 2005 12:14 PM Environment: Hibernate 3.0.5, SQL Server 2000 SP2 Description: I have this exception: 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) with this code: 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(); and this mapping document: <?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> 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. Regards Alessandro Rizzi --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |