glassfish « Transaction « JPA Q&A





1. How to implement pessimistic locking in JPA with Glassfish 2.1?    stackoverflow.com

When trying to setup a lock (pessimistic), with the following code:

em.lock(controlnumbers, LockModeType.WRITE);
em.refresh(controlnumbers);
I am getting the following exception:
[#|2009-09-10T15:42:48.324-0400|INFO|sun-appserver2.1|javax.enterprise.system.container.ejb|_ThreadID=31;_ThreadName=httpSSLWorkerThread-8080-19;|
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.persistence.PersistenceException: ejb30-wrong-lock_called_without_version_locking-index (There is no English translation ...

2. Error while using two EntityManagers simultaneously in GlassFish v2    stackoverflow.com

I have a stateless session bean (slsb) that has a dependency on two other beans that act as DAOs. They both use JPA so each bean has a EntityManager. They point ...

3. Stateless beans / JPA - when comit transactions occure?    java.net

glassfish@javadesktop.org wrote: > I have a strange behavious when I try to merge entities with modified values but nothing occures... > > > This is my scenario: > I have a stateless EJB named 'fooEjb' with one method that updates some entities that looks like: > > @Stateless() > public class FooBean implements FooLocal { > public void updateEntities(Collection entities) { ...

4. Glassfish "locking up" when saving data via JPA    java.net

[#|2007-06-04T11:50:03.249-0700|FINE|sun-appserver-pe9.0|oracle.toplink.essentia ls.file:/D:/Sun/AppServer/domains/domain1/applications/j2ee-apps/j2core/zuma-ejb _jar/-zuma-ejbPU.sql|_ThreadID=13;_ThreadName=httpWorkerThread-8080-0;ClassName= null;MethodName=null;_RequestID=f7b043c1-bd4d-4ff0-b6d7-8f5cab5e82ed;|INSERT INT O JBSTATEMENT (JBSTATEMENTKEY, ADDRESSLINE3, CITY, STATEMENTNBR, REGION, ENTITYK EY, COUNTRYCODE, EMAILADDRESS, COUNTRYNAME, ADDRESSLINE1, TAXREGNUMBER, CONTACTN BR, ADDRESSLINE2, CUSTOMERNAME, BILLINGDATE, JBSTATEMENTTYPEKEY, JCENTITYKEY, JB STATEMENTSTATUSTYPEKEY, JBSTATEMENTBATCHKEY) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) bind => [8, null, null, 8, null, 34848, null, null, null, null, ...

5. JPA: when can you used JTA?    java.net

6. JPA optimistic locking inconsistency    java.net

Assuming yes, here is what I observe: external modifications done in this way are only picked up by the first class, the other one gets stale data. The only difference between both classes is that the one that is not working right has a number of ManyToOne declarations, whereas the working class has no relationships. I did try to set CascadeType.REFRESH ...

7. JTA/XA Transactions with Hibernate and OpenMQ    java.net

How do you use JTA/XA transactions and declarative transaction management if not using EJB in Glassfish? I would like to configure my application to use Spring and make use of its JtaTransactionManager (which I assume would need to be wired to use the TransactionManager provided by Glassfish). Has anyone else done this in Glassfish?

8. JPA OptimisticLockException even after I locked the entity    java.net

I did some googling and saw someone suggesting doing a flush(), then catching OptimisticLockException, then doing a refresh(). When would I do this? Immediately after calling lock(), or immediately after my merge()? If I did it after the merge(), then I'd have to re-do all the work on the entity to set the new values.

9. EJB Timer, JPA Entities, XA Transaction Glassfishv3 stops flushing updates.    java.net

After moving the application to glassfishv3 (now 3.0.1) updates to entity B stop been flushed to database B after a random amount of time (1 - 12 hours) while the respective update to entity A in database A is flushed (this is within an XA transaction). The crazy thing is the inserts for new entities B are flushed to database B ...





10. JPA + JTA + Glassfish    java.net

Now, I want to use Glassfish EntityManager instead of Hibernate and thus I want it to automatically manage transactions; to achieve this I understand that I have to change a setting in the persistence unit to JTA. But what I really need to understand is how Glassfish+JTA manages transactions: how does it know when to begin them? How does it know ...

11. issue with flush on commit with glassfish v3    forum.hibernate.org

Newbie Joined: Thu Jun 24, 2010 12:23 pm Posts: 2 Hi. I'm hoping that someone might be able to point me in the right direction with this issue. I'm in the process of migrating an application from WebSphere 5.1 to Glassfish 3.0.1 So far it has gone fairly smoothly until last week. My setup: Galssfish 3.0.1 full profile mysql jdb driver ...

12. Hibernate in Glassfish, marking transaction for rollback    forum.hibernate.org

Author Message aerialblue Post subject: Hibernate in Glassfish, marking transaction for rollback Posted: Thu Mar 19, 2009 12:42 am Newbie Joined: Wed Mar 18, 2009 10:47 pm Posts: 1 Location: Mendoza, Argentina Hi all, I've been using Hibernate for a couple of months now as my persistence provider in Glassfish, and everything's gone well mostly, except for the occasional ...

13. Transaction Management PROBLEM with Glassfish    forum.hibernate.org

Hello, I'm using hibernate 3 with Glassfish 2.1 I'm having some issues with transactions, according to Hibernate documentation, the use of org.hibernate.transaction.JTATransactionFactory lets Hibernate to check weather a Container Managed Transaction is running and if so relying on that, otherwise creates a new transaction (looking up for java:comp/UserTransaction). my code is something like: Code: Transaction tx = null; try { ...