• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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!
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic