Hibernate version: 3.0.5
Mapping documents: N.A.
Code between sessionFactory.openSession() and session.close(): N.A.
Full stack trace of any exception that occurs:
11:46:30,458 INFO DefaultLoadEventListener:85 - Error performing load command
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.tougher.intranet2.employee.grouping.Grouping#171]
at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:118)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:75)
at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:643)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:59)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
at com.tougher.intranet2.employee.grouping.Grouping$$EnhancerByCGLIB$$c5064040.toString(<generated>)
at java.lang.String.valueOf(String.java:2131)
at java.lang.StringBuffer.append(StringBuffer.java:370)
at com.tougher.intranet2.employee.unit.testing.UnitFacadeTransactionTest.testupdateUnitWithoutGroupingChangeUnitNameAndExistingGrouping(UnitFacadeTransactionTest.java:251)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
Name and version of the database you are using:
MySQL 4.1.9
The generated SQL (show_sql=true):
Hibernate: select unit0_.unit_code as unit1_0_, unit0_.unit_name as unit2_1_0_, unit0_.group_code as group3_1_0_, unit0_.super_unit_code as super4_1_0_ from unit unit0_ where unit0_.unit_code=?
Hibernate: select grouping0_.group_code as group1_0_, grouping0_.group_name as group2_0_0_ from grouping grouping0_ where grouping0_.group_code=?
Debug level Hibernate log excerpt:
Hibernate: select unit0_.unit_code as unit1_0_, unit0_.unit_name as unit2_1_0_, unit0_.group_code as group3_1_0_, unit0_.super_unit_code as super4_1_0_ from unit unit0_ where unit0_.unit_code=?
Hibernate: select grouping0_.group_code as group1_0_, grouping0_.group_name as group2_0_0_ from grouping grouping0_ where grouping0_.group_code=?
11:46:30,458 INFO DefaultLoadEventListener:85 - Error performing load command
Hello,
I'm having a puzzling problem with Hibernate.
I'm using JUnit to test my business methods.
On setup, I clear the session so every test case has the same initial state.
I just have 2 classes now, Grouping and Unit,
where a Unit belongs to a Grouping.
When I run all of the test cases in the Unit test case,
there is that one error with the method
testupdateUnitWithoutGroupingChangeUnitNameAndExistingGrouping
(com.tougher.intranet2.employee.unit.testing.UnitFacadeTransactionTest)
The puzzling thing is that when I run it alone, it succeeds.
When I move it one method up or one method down
and run the whole test, it succeeds.
But when it is in its current position, it fails.
The problem is consistent, meaning, even when I run the test as a whole again,
the same failure happens.
The line that's throwing an Exception is
just a simple retrieval of a Unit object, with an associated Grouping.
The problem as I see it is that it is retrieving a non-existent Grouping.
When I debug it and look at the database before retrieval,
the data in the database exists.
For this particular test case, the group_code should be -4,
as in the database, not 171, as it is in the log.
I'm very sorry but I really have no idea what or where the problem is.
I might as well give the whole project,
and see if anyone can figure out what's wrong.
The file would be available for one week only.
It contains all files including sql file for filling tables.
Thanks in advance.
http://s34.yousendit.com/d.aspx?id=3CJASDPSY5I7P0DKPMWO2KH3V3