This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Entity not persisting

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use a Stateless Session Bean and Container Managed Persistence to update data in my data base using aWeblogic 10 server, Oracle 10 database and the supplied Kodo PersistenceManager. My persistence xml looks like this:

<persistence-unit name="myManager" transaction-type="JTA">

I can find the data just fine. When I modify a value and call persist that seems to execute without and error, at least none that I have been able to detect. However when I look at the database the data has not been modified.

If I simply create the EntityManager and call em.getTransaction().begin(), modifiy the data, call persist, then call em.getTRansaction().commit() the data in the DB has been modified. However this way I am not letting the container manager the transaction.

Any suggestions as to what I am doing incorrectly or how to get more information.

thanks in advance
Posts: 4223
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can read the data in the entity just fine but cannot write, I'd check to see if there's an exception somewhere you might be swallowing. Also, its possible, albeit unlikely, your database user logon does not have permission to write to the database.
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot call em.getTransaction() in container managed transactions because it will throw IllegalStateException.

Maybe you could provide the code of the persistence.xml and session bean.
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic