aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB 3 Persistence in a remote Stateless Session Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB 3 Persistence in a remote Stateless Session Beans" Watch "EJB 3 Persistence in a remote Stateless Session Beans" New topic
Author

EJB 3 Persistence in a remote Stateless Session Beans

Daniel Jabonete
Ranch Hand

Joined: Apr 01, 2007
Posts: 78
Greetings!

I am having some problem in inserting some records in MySQL 5 database using EJB 3 Stateless SessionBean with the EntityManager injected in it.

persistence.xml


EmployeeBeanImpl.java


Test1.java


When I’d ran the Test1.java it returns the following error below:

My suspected problem were on the EntityManager, but not perfectly sure about that, and how to persist an entity in a session beans.

Hoping for your help with regards to the stated problems.

Thanks very much. I really appreciated your time.

Cheers!
bhupesh ravish
Greenhorn

Joined: Sep 12, 2006
Posts: 11
em.getTransaction().commit();

Try removing this line. I feel it should not be there n may be it is creating the problem.
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

@Daniel Jabonete

sir.. may i know your EJB Container?..

Thanks in advance..


Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Daniel Jabonete
Ranch Hand

Joined: Apr 01, 2007
Posts: 78
hi guyz,

got it solved.

i am using glassfish, what i did was changed the set-up configuration in Resources> JDBC> JDBC Resources JNDI Name: jdbc/__default to the database schema defined in my pointing persistence.xml file.

thou, i am not sure 'yet in the case if my application would like to access multiple database schemas at the same time.

thanks very much!

cheers!
 
wood burning stoves
 
subject: EJB 3 Persistence in a remote Stateless Session Beans