-->
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: JTA synchronization exception when after setRollBackOnly
PostPosted: Mon Sep 13, 2004 7:23 pm 
Beginner
Beginner

Joined: Wed Jan 21, 2004 10:52 pm
Posts: 27
Location: Santa Cruz do Sul - RS - Brazil
JBoss: 3.2.3 on WindowsXP / Hibernate: 2.11 / Postgres 7.4

Hi all, sorry my english, I'm braziliam and this text was translated with babelfish :-)

I have an problem with Hibernate using MBean solution provided by http://www.hibernate.org/66.html
The problem is:

The ejbA have a business rule thats call 2 sucessive hibernate methods in ejbB, like this (all ejbs are stateless):

Code:
//in ejbA

EjbB ejbB = null;

public void ejbCreate() {
    ejbB = ((EjbBHome) serviceLocator.getService(EjbBHome.JNDI_NAME)).create();
}

public boolean removeActorByID(int id) {
  String hql = "from Actor a where a.id = " + id;
  ejbB.delete("hql");
  if (ejbB.find("hql") == null) {
    return true;
  }
  return false;
}

//in ejbB (This ejb is based on Konstantin Pribluda's Hibernate demo implementation)

public void delete(String query) {
  try {
   Session session = getSession();
   session.delete(query);
   session.flush();
   session.close();
  } catch (Exception e) {
   ctx.setRollbackOnly();
  }
}

public List find(String query) {
  List objs = null;
  try {
   Session session = getSession();
   objs = session.find(query);
   session.close();
  } catch (Exception e) {
    return null;
  }
  return objs;
}



The error occurs in EjbA when "find" is called after "delete" raise an error (eg Violates FK), calling setRollBackOnly.

The error is "Could not register synchronization with JTA TransactionManager"

I know that this error not is caused by Hibernate (http://forum.hibernate.org/viewtopic.ph ... +exception), but how I can resolve it? I need to synchronized these ejbs? How?

_________________
Do you still create DTO factories? Oh, no!
Try DTOptimzier now!
https://dtoptimizer.dev.java.net/


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.