Issue Details (XML | Word | Printable)

Key: HHH-1567
Type: Bug Bug
Status: Resolved Resolved
Resolution: Duplicate
Priority: Major Major
Assignee: Gail Badner
Reporter: Paul Lorenz
Votes: 2
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Hibernate Core

load fails where get succeeds

Created: 14/Mar/06 09:16 AM   Updated: 16/Jun/08 02:40 PM   Resolved: 16/Jun/08 02:40 PM
Component/s: core
Affects Version/s: 3.1.2
Fix Version/s: None

Time Tracking:
Not Specified

Environment: hibernate 3.1.2 against sysbase 12.5.2 using jconn3 jdbc driver
Issue Links:
Duplicate
 

Bug Testcase Reminder (view):
REMINDER: Bug reports should generally be accompanied by a test case
Participants: Gail Badner, Konstantin Ignatyev and Paul Lorenz


 Description  « Hide

I have a POJO which has a column

protected Case data;

@Type ( type="serializable" )

@Basic( fetch=FetchType.EAGER )

public Case getData ()

{ return data; }

public void setData (Case data)

{ this.data = data; }

I am iterating over every element in the corresponding database table.

Session session = HibernateUtil.currentSession();
SQLQuery query = session.createSQLQuery( "select case_id from wf_case" );
query.addScalar( "case_id", Hibernate.LONG );
List<Long> caseList = query.list();

for ( Long caseId : caseList )
{
WfCase wfCase = (WfCase)session.load( WfCase.class, caseId );
if ( wfCase.getData() == null )

{ System.out.println( "IS null: " + caseId ); }

session.evict( wfCase );
}

when I run this, after running through 1500 or 2000 (this number changes between runs), I start getting null returns from wfCase.getData(). After that point, it always returns null. If I call session.evict( wfCase ) on an wfCase which returned null, I get the following exception.

Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy23.evict(Unknown Source)
at hibernate.test.MilestoneCheck.main(MilestoneCheck.java:64)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
... 2 more
Caused by: java.lang.NoSuchMethodError: com.gblx.improv.fit2flow.engine.WfCase.getHibernateLazyInitializer()Lorg/hibernate/proxy/LazyInitializer;
at com.gblx.improv.fit2flow.engine.WfCase$$EnhancerByCGLIB$$616ee93d.getHibernateLazyInitializer(<generated>)
at org.hibernate.event.def.DefaultEvictEventListener.onEvict(DefaultEvictEventListener.java:47)
at org.hibernate.impl.SessionImpl.fireEvict(SessionImpl.java:965)
at org.hibernate.impl.SessionImpl.evict(SessionImpl.java:957)
... 6 more

Now, if I change the session.load to session.get, it runs through without any problems. I thought maybe the second level cache provider was to blame, but I switched to using <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> in my cfg file, and I still had the same problem.

Note, I had the same problem when I wasn't using a serializable type, but was rather just mapping it to a byte[].



Konstantin Ignatyev added a comment - 17/Mar/06 11:37 AM

There is a repro cases I have created for a similar issue
http://opensource2.atlassian.com/projects/hibernate/browse/HHH-1579

the immediate remedy seems to be -server flag for JVM