This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Entity not persisting Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Entity not persisting" Watch "Entity not persisting" New topic
Author

Entity not persisting

Tim Piety
Greenhorn

Joined: Oct 05, 2008
Posts: 1
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">
<jta-data-source>MyDataSource<jta-data-source>
<class>MyClass</class>
</persistence-unit>

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
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3652

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.


My Blog: Down Home Country Coding with Scott Selikoff
Jerwin Louise Uy
Ranch Hand

Joined: Oct 27, 2007
Posts: 75
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.


Uy Jerwin Louise Vergara
Junior Developer / Research and Development at Incuventure Partners Corporation
email: jerwin.uy@incuventure.net
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Entity not persisting
 
Similar Threads
Persitence confusion. Please help.
Java Persistence API: Multiple Persistence Units problem
Kodos + XA DataSource + Weblogic 10
Kodos and XA Datasource on Weblogic 10
Setting JTA with JPA