Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 3 Persistence in a remote Stateless Session Beans

 
Daniel Jabonete
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 489
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Daniel Jabonete

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

Thanks in advance..
 
Daniel Jabonete
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic