Insert « Transaction « JPA Q&A





1. How do I prevent JPA inserts from locking a database table?    stackoverflow.com

I'm using Hibernate backed JPA as my persistence layer. I have a multi-threaded process that aggregates data from a Soap call and then stores a row in a database. The process ...

2. Hibernate PostInsertEventListeners -Use Same Transaction as insert?    stackoverflow.com

I have some hibernate code that performs an insert into the database, and on completion of that insert a customized PostInsertEventListener is fired. (Essentially a trigger to ensure that other records ...

3. Why is INSERT made after em.persist in FlushModeType.COMMIT?    stackoverflow.com

I have set FlushModeType to COMMIT, but right after em.persist() call, the INSERT is made to database. I expect Hibernate to write changes to database only at the end of transaction, ...

4. currently inserted value from table with in a transaction    forum.hibernate.org

I need currently inserted value from table with in a transaction. In the particular scenario I cannot use any locking mechanism, because locking all affected in transaction commit, Actually am inserting a value to a table, just after that I need that inserted value . Eg: Begin Transaction Insert - value to table select the value from table Commit transaction ....... ...

5. one-to-one - how to insert couple in one transaction?    forum.hibernate.org

I have two objects: InstrumentStatic and InstrumentDynamic that are associated in one-to-one relationship How can I insert two new isntances associated one-to-one in one transaction? Becase when I do somethig like this: Code: InstrumentStatic instrumentStatic = new InstrumentStatic(); InstrumentDynamic instrumentDynamic = new InstrumentDynamic(); instrumentStatic.setInstrumentDynamic(instrumentDynamic); ...

7. update after insert and optimistic locking via triggers    forum.hibernate.org

Newbie Joined: Thu Mar 03, 2005 12:43 pm Posts: 1 We have a problem with using database triggers for optimistic record locking. We want to use triggers TOGETHER with Hibernate support of the in the mapping file. This is necessary, since we are expecting other applications to access & change the data in the database. The trigger catches inserts and ...

8. Rollback after inserting of a new Object with HibernateExcep    forum.hibernate.org

Newbie Joined: Wed Mar 16, 2005 5:15 am Posts: 2 Read the rules before posting! http://www.hibernate.org/ForumMailingli ... AskForHelp I want to save (first it hjas to insert it) a new instanceof NatuerlichePerson. The id is initially 0. Now I saveOrUpdate it. The Id in NatuerlichePerson is set to 1, but now an error occurs, because one field is null and the ...

9. deadlock with insert on a "many" and update on its    forum.hibernate.org

Hibernate Community View topic - deadlock with insert on a "many" and update on its Login Register FAQ Search View unanswered posts | View active topics Board index Hibernate & Java Persistence Hibernate Users All times are UTC - 5 hours [ DST ] deadlock with insert on a "many" and ...





10. PostInsertEventListener and Transaction - double insert    forum.hibernate.org

I am using hibernate v 3.1.beta1 and Spring 1.2.6 While using hibernate's PostInsertEventListener I am having a double insert issue. I have a saveAbc(Abc abc) method defined in a singleton service object and that has spring-transaction annotation @Transactional(propagation = Propagation.REQUIRED) There is a PostInsertEventListener setup that has following in its onPostInsert() method implementation. It calls another singleton service object's saveHistory(Object o) ...

11. How to do a full table lock (preventing inserts)?    forum.hibernate.org

Does anyone know how to do a full table lock in Hibernate? I have to do some business validations on the existing data before I insert my object, but I want to prevent any inserts while I'm in the process of validation. Or is there a better way to do this? Thanks! Jos

12. PostInsertListener + "post-commit-insert"    forum.hibernate.org

Hi, I'm using a custom PostInsertEventListener mapped to the "post-commit-insert" event to process domain objects. However, PostInsertEventListener's onPostInsert(PostInsertEvent) is getting called even when the insert was not successful (ie, due to a unique constraint in the database or some such). This question was already asked here but received no response: is this expected behavior? It looks to me like Hibernate should ...

13. problem to insert file or three insert in 1 transaction    forum.hibernate.org

Author Message sahar.m Post subject: problem to insert file or three insert in 1 transaction Posted: Sun Feb 18, 2007 4:32 am Newbie Joined: Sun Feb 18, 2007 4:06 am Posts: 2 Please HELP! I am using netbean 5.5 with Hibenate 3.0 and my db is mysql 1.2.9. I have 4 tables in my project : **************HibernateUtil.java ************************ package ...

16. Multiple transactions that insert into same table    forum.hibernate.org

In one of our applications we are facing a problem when multiple transactions insert rows into the same table. We are using Hibernate with Spring. We have a table that contains the list of client numbers. Our application creates additional client information that should be linked to the client number. In a normal situation, the processing checks the existence of the ...





17. Reset object PKs after insert failure and rollback?    forum.hibernate.org

When attempting to saveOrUpdate() a number of objects, Hibernate assigns the primary key to the objects as they are inserted. Unfortunately, if an exception is thrown by, say, the 4th saveOrUpdate() call, the first 3 objects inserted still have their primary key set even after rolling back the transaction. The problem with that is that when a saveOrUpdate is retried for ...

18. Insert commands don't commit as expected    forum.hibernate.org

I am unable to get records inserted into the database predictably. I've been looking all over for an answer, but can't find one. I'm running Hibernate 3.2.6 and HSQL 1.8.0.10 in standalone mode. When I create and commit a transaction, I am not seeing any changes in the database. Not only do I not get the inserts, I also am not ...

19. Hibernate: ensure exception thrown BEFORE the tx.commit will not do INSERT    forums.oracle.com

xianwinwin wrote: Hi guys, Using Hibernate, how can you ensure that nothing will be insert to the db with the code below (when it get's to 21 it throws an exception). If I comment out line 15 and 16, everything will be insert. Also, what is the terminology that describes this kind of insert (where only the tx.commit(); will perform the ...