persist « Transaction « JPA Q&A





1. Is it possible to use more than one persistence unit in a transaction, without it being XA?    stackoverflow.com

Our application needs to use (read-only) a couple different persistence units pointing to different databases (different, commercial vendors as well). We do not have the budget to enable 2pc on one of ...

2. How should I handle persistence in a Java MUD? OptimisticLockException handling    stackoverflow.com

I'm re-implementing a old BBS MUD game in Java with permission from the original developers. Currently I'm using Java EE 6 with EJB Session facades for the game logic and JPA ...

3. declare a transaction in ejb 3.0    stackoverflow.com

how can I force the EJB to not flush everything after every single command, I want to do a transaction. I've read that this is done somehow declaratively. But how exactly?

@Stateless
public ...

4. How to persist a JPA autogenerated value before commit?    stackoverflow.com

Hi I am beginner on the JPA world, I have a question on the auto-generated id. We are using OpenJPA, My application requires that one operation which creates bunch of related ...

5. Hibernate transaction end example    stackoverflow.com

This is a very simple example of hibernate usage in java: a function that when it's called, it creates a new object in the database. If everything goes fine, the changes ...

6. What is the difference between a session and a transaction in JPA 2.0?    stackoverflow.com

I just begin my JPA 2.0 studies, and I have this piece of code:

em = SessionFactory.startSession();
tx = em.getTransaction();
My problem is: I'm not sure if I completly understand the difference between the ...

7. Hibernate Transaction nor persisting object changes    stackoverflow.com

I am developing a Spring/Hibernate application and I am seeing some unexpected behaviour whilst trying ot make updates to existing objects. Currently, I have a service class method that simply updates an ...

8. What does the "Use Java Transaction APIs" checkbox do in Netbeans persistence.xml    stackoverflow.com

In Netbeans in the persistence.xml there is a checkbox called "Use Java Transaction API" this changes the xml from:

<persistence-unit name="PUNAME-PU" transaction-type="RESOURCE_LOCAL"> 
To:
<persistence-unit name="PUNAME-PU" transaction-type="JTA">
Is this for CMT vs BMT?

9. JPA and persist(),commit    forum.hibernate.org

Newbie Joined: Sun Nov 15, 2009 5:31 pm Posts: 1 Hi i am try to batch insert in JPA but i couldnt do,but i did everything that i read from books or forums. This is reader Class Code: @Entity public class Readers implements Serializable { @Id @GeneratedValue @Column(name="readerId",columnDefinition ...





10. Hibernate persistence and Transaction    forum.hibernate.org

Hi everyone i'm new to hibernate. i have a task presently that i need to solve with hibernate. The description is like this - 1. Get some records from different tables from a remote database based on some criteria. 2. Insert the records in a local database. 3. Delete the inserted records from the remote database once the insertion in complete. ...

11. Persistence rollback exception    forum.hibernate.org

I'm persisting two entities, the second one has a unique constraint but when I try to break that constraint a javax.persistence.RollbackException: Transaction marked as rollbackOnly is thown so the first persisted entity is not rolled back. Im using the @Transactional Spring annotation, anyway here is the code , I'd appreciate very much any help : Spring application context : . . ...

12. instance is handled as persistent after rollback    forum.hibernate.org

Hello, I have a strange issue and I do not find the right query to google for. following situation - ORACLE Database - Sequences as ID generator. Record "OrderHeader" contains a Set of "OrderLines" as childs. While saving the header object, all lines were updated to the database to, I do not need to save the lines. (thats great!) Now I ...

13. Persistent and non-persistent objects in one transaction    forum.hibernate.org

I'm doing exactly that: hanging on to a session in a ThreadLocal, initialising and closing it at business process boundaries (these happen to be stateless session bean calls). Can I get a non-persistent object out of a session? I can't map it as read only, because sometimes I want to update it. I can't evict() it because it might already exist ...

14. 2.1.3 Session.lock() causing updates to not persist    forum.hibernate.org

I notices my changes were not being persisted to the database, and when I took away this call (right before the sess.update): sess.lock(inObj, LockMode.NONE); ..my changes started persisting again. Could someone explain to me when this is needed, and when it is not? I causes a lot of confusion at home/work. Should we not be using it? Sometimes if we dont ...

15. persistence problems after transaction rollback    forum.hibernate.org

Hi, I am running a test to make sure that my system can recover from a persistence exception. My test scenario is: I persist an entity with a mandatory field set to null (in order for the save to fail) I catch the exception being thrown I populate the missing field I re-persist the entity I expect the entity to be ...