-->
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: TransientObjectException: proxy was not associated with the
PostPosted: Thu Feb 26, 2009 5:51 am 
Newbie

Joined: Wed Jul 23, 2008 10:48 am
Posts: 5
Hello experts,

we have a problem with hibernate inside JBPM, but we believe that is more a hibernate problem than a JBPM problem.

We have a class accessing the hibernate session from the jbpm context. Most of the time the method is executed correctly, but randomly
the method throws a "TransientObjectException: proxy was not associated with the session". See below the part from our class.

Code:
      public ProcessInstance instanceForEntity(VehicleRelated entity, ProcessDefinition def) {

            Session session = getJbpmContext().getSession();
           
            if (!session.contains(entity)) {
                if (log.isDebugEnabled()) {
                    log.debug(String.format("Session doesn't contains entity %s -> persisting entity.", entity));
                }
                session.persist(entity);
            }

            Query query = session.getNamedQuery(EntityToProcessInstance.BY_ENTITYNAME_ID);

            String entityName = session.getEntityName(entity);
            query.setString("entityName", entityName );
            query.setLong("entityId", entity.getId() );


The interesting thing is that the session.contains(entity) returns true, so the entity is associated within the session.
The session.getEntityName(entity) throws the exception.

Is this issue related to Jira HHH-3230?
Is there an workaround?

Thanks for you help
Marco

Hibernate version: 3.3.1.GA

Full stack trace of any exception that occurs:

Code:
java.lang.reflect.UndeclaredThrowableException
   at $Proxy52.getEntityName(Unknown Source)
   at $Session_11faea3bd49.getEntityName($Session_11faea3bd49.java)
   at $Session_11faea3bd4a.getEntityName($Session_11faea3bd4a.java)
   at $Session_11faea3bd4b.getEntityName($Session_11faea3bd4b.java)
   at core.processManagement.system.ProcessContextFactory$ProcessContextImpl.instanceForEntity(ProcessContextFactory.java:79)
   at $ProcessContext_11faea3bd56.instanceForEntity($ProcessContext_11faea3bd56.java)
   at $ProcessContext_11faea3bd57.instanceForEntity($ProcessContext_11faea3bd57.java)
   at module.stateMachine.JbpmVehicleEventSink.getProcessInstanceForVehicle(JbpmVehicleEventSink.java:274)
   at module.stateMachine.JbpmVehicleEventSink.invoice(JbpmVehicleEventSink.java:80)
   at $VehicleEventSink_11faea3bd3f.invoice($VehicleEventSink_11faea3bd3f.java)
   at $VehicleEventSink_11faea3bd3e.invoice($VehicleEventSink_11faea3bd3e.java)
   at module.invoicing.service.invoicingService.InvoicingServiceImpl.invoiceInvoicableVehicles(InvoicingServiceImpl.java:132)
   at module.invoicing.service.invoicingService.InvoicingServiceImpl.run(InvoicingServiceImpl.java:70)
   at $Runnable_11faea3bd40.run($Runnable_11faea3bd40.java)
   at $Runnable_11faea3bd37.run($Runnable_11faea3bd37.java)
   at $Runnable_11faea3bd36.run($Runnable_11faea3bd36.java)
   at ch.bmw.batch.BatchDriver.execute(BatchDriver.java:127)
   at ch.bmw.batch.BatchDriver.runMain(BatchDriver.java:318)
   at ch.bmw.batch.BatchDriver.main(BatchDriver.java:307)
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.javaforge.honeycomb.hivemind.hibernate.HibernateSessionFactory$SessionProxy.invoke(HibernateSessionFactory.java:227)
   ... 19 more
Caused by: org.hibernate.TransientObjectException: proxy was not associated with the session
   at org.hibernate.impl.SessionImpl.getEntityName(SessionImpl.java:1771)
   ... 24 more

Name and version of the database you are using:

Oracle 10g
[/url][/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.