• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

EJB 3 Persistence in a remote Stateless Session Beans

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
If you look closely at this tiny ad, you will see five bicycles and a naked woman:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic