-->
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.  [ 7 posts ] 
Author Message
 Post subject: QueryImpl 'losts' original Exception
PostPosted: Tue Aug 22, 2006 6:21 am 
Newbie

Joined: Tue Aug 22, 2006 5:17 am
Posts: 3
Hi,

when using org.hibernate.ejb.QueryImpl with WebSphereExtendedJTATransactionLookup I'm facing following problem.

Hibernate throws an exception due to bug in my query (which is o.k. - I don't need help with that), and the exception is handled by following code in QueryImpl:

Code:
   public List getResultList() {
      try {
         return query.list();
      }
      catch (HibernateException he) {
         em.throwPersistenceException( he );
         return null;
      }
   }


AbstractEntityManagerImpl.throwPersistenceException() tries first to rollback a transaction - which is not implemented in WebSphereExtendedJTATransactionLookup, so it causes an UnsupportedOperationException.

So, the original exception is lost and never logged to console or whatever else.

Should I report this as a bug into JIRA?

Thanks,
Lukas

Hibernate version:
Code:
org.hibernate.ejb.Version <clinit> Hibernate EntityManager 3.2.0.CR1
org.hibernate.cfg.annotations.Version <clinit> Hibernate Annotations 3.2.0.CR1
org.hibernate.cfg.Environment <clinit> Hibernate 3.2 cr2
org.hibernate.cfg.Environment <clinit> hibernate.properties not found
org.hibernate.cfg.Environment buildBytecodeProvider Bytecode provider name : cglib
org.hibernate.cfg.Environment <clinit> using JDK 1.4 java.sql.Timestamp handling


Full stack trace of any exception that occurs:
Code:
        java.lang.UnsupportedOperationException
        at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.setRollbackOnly(WebSphereExtendedJTATransactionLookup.java:97)
        at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java:392)
        at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:545)
        at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:567)
        at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:56)
        at cz.kb.statementsetup.dao.StatementSetupDAO.getActualStatementConfig(StatementSetupDAO.java:32)



Name and version of the database you are using:
Oracle 9i


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 22, 2006 9:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
em.throwPersistenceException actually throws the exception....so return null is never executed.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 22, 2006 9:35 am 
Newbie

Joined: Tue Aug 22, 2006 5:17 am
Posts: 3
max wrote:
em.throwPersistenceException actually throws the exception....so return null is never executed.


yeah, but it's supposed to throw org.hibernate.QueryException, but in AbstractEntityManagerImpl is following code:
Code:
public void throwPersistenceException(PersistenceException e) {
   if ( ! ( e instanceof NoResultException || ( e instanceof NonUniqueResultException ) ) ) markAsRollback();
   throw e;
}


and if markAsRollback() throws another exception (UnsupportedOperationException in my case), the original exception is lost forever.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 22, 2006 10:00 am 
Newbie

Joined: Tue Aug 22, 2006 5:17 am
Posts: 3
...
sorry posted that twice


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 22, 2006 10:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
see, that is much more precise ;)

i would put that in ejb jira.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 22, 2006 10:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
see, that is much more precise ;)

i would say you should put that in ejb jira.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 12:42 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
http://opensource.atlassian.com/projects/hibernate/browse/EJB-218

If someone knows how to properly implement this @&#'! Transaction manager lookup on WebSphere, please advise.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

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.