Caucho Forums  

This forum is permanently closed because of spam. For free community support, please visit Google Groups:


Go Back   Caucho Forums > Resin

Reply
 
Thread Tools Display Modes
  #1  
Old 03-27-2012, 02:05 AM
Lehabey Lehabey is offline
Junior Member
 
Join Date: Mar 2012
Posts: 10
Default Resin JPA, JTA configuration

Hi, I'm new to JPA and to Resin.
I'm trying to do CRUD using JPA.
I followed http://wiki.caucho.com/Hibernate and I can get users from DB. However if I add the following code:

CourseBean newCourse = new CourseBean();
newCourse.setCourse("test"
newCourse.setTeacher("test"

I get no exceptions and no changes in db. I'm obviously not creating a transaction explicitly nor requesting java to save new object.

If I add:
_manager.persist( newCourse );

I get:
javax.persistence.TransactionRequiredException: persist must be called
within transaction.

if I add _manager.getTransaction.begin(), ... commit(); I get errors as well.

I understand it runs implicit transaction but how do I tell it to save the object? Could you please provide an example code?
Reply With Quote
  #2  
Old 04-13-2012, 11:55 AM
Lehabey Lehabey is offline
Junior Member
 
Join Date: Mar 2012
Posts: 10
Default Use @Transactional annotation

I had to use @Transactional annotation on the method and use EJB stateless bean. There are many examples on the net.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:42 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.