-->
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: CMT doesn't work with Hibernate+JBoss+MySQL
PostPosted: Thu Oct 14, 2004 6:55 pm 
Newbie

Joined: Thu Oct 14, 2004 6:49 pm
Posts: 1
Everything works. I mean -- all records are created correctly.
But the problem that CMT (Container Managed Transactions) doesn't work with Hibernate. MySQL tables type is InnoDB, so it's not a problem.

I am calling this code from EJB Statless Session Bean which is running in "RequiresNew" transaction.

If I use ctx.setRollbackOnly() it have to do rollback in any case.
But it doesn't.

What could be the problem?


Hibernate version:

2.1

Mapping documents:

Code between sessionFactory.openSession() and session.close():

// work with Hibernate from this place
try {

Configuration config = new Configuration()
.addClass(Person.class)
.addClass(Pet.class);

SessionFactory sessionFactory = config.buildSessionFactory();
Session session = sessionFactory.openSession();
Transaction txn = session.beginTransaction();

Person john = new Person();
john.setFirstName(fname);
john.setLastName(lname);

Pet rover = new Pet();
rover.setName(petname);

john.addPet(rover);
rover.setFriend(john);

session.save(john);
txn.commit();
session.flush();
session.close();

} catch(Exception ex) {
System.out.println("Error: " + ex);
}

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


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.