call « Transaction « JPA Q&A





1. Question about flushing with JPA before a query is called    stackoverflow.com

Just a quick question, but is the flush necessary in this code? Note this would be inside of a JPA transaction.

User user = new User();
em.persist(user);

em.flush;

User aUser = em.find(User.class,user.getId());
assert(user.equals(aUser));
Or is will it ...

2. Concurrent calls to API to return different object    stackoverflow.com

I have the following scenario Query results:

student1  subject1  marks1
student2  subject1  marks3
...
...
The API code looks like this
StudentObj getStudentInfo() {
    List<StudentObj> stObj = StudentDAO.getRows(); //

  ...

3. Hibernate : PL/SQL call for each transaction    stackoverflow.com

I'm working with an application using Hibernate, connected to an Oracle database. I need to make a PL/SQL procedure call at the beginning of each transaction (to activate some policies that depend ...

4. Lost updates in concurrent EJB calls (JTA)    forum.hibernate.org

I'm using hibernate 3.3 with session beans in a Jboss environment (JTA). I have an EJB that has two methods that can be called concurrently by two clients, and both methods can update different fields of a Person entity. Because of concurrency I'm having same lost updates in the associate collections of my entity because of the commit order (that of ...

5. Can't call commit when autocommit=true ?!!    forum.hibernate.org

6. transaction never commited even when tx.commit is called    forum.hibernate.org

Hi there, I am using hibernate in stateless session beans. i have got a problem where a tx is started and it will do occasional commits in a loop within the same single session. however, during a test, i explicity rollback the tx(after a few commits) . i did a check with the database and realized that whatever i have "commited", ...

7. Interspersing JDBC calls with Hibernate (same transaction)    forum.hibernate.org

For some very bizarre reasons, we need to call some SQL after we have save or updated an object in Hibernate. We get the connection from hibernate's session, and then issue our JDBC executeUpdate. it appears to work, but I want to make sure there aren;t any edges cases to worry about. There may be other issues, but here are the ...

8. Transaction deadlock exception during session.refresh call.    forum.hibernate.org

Read the rules before posting! http://www.hibernate.org/ForumMailingli ... AskForHelp Hi!! I sometimes get the following exception: "Transaction (Process ID 63) was deadlocked..." (full stack trace below), when running the attached code. This is the only code that touch the specific db table. The reason (so I'm told by the original writers) for the call to refresh is some weird behaviour of Oracle ...

9. Object state after lock() call    forum.hibernate.org





10. autocommit=true and call to beginTransaction()    forum.hibernate.org

Hibernate will depend on JDBC or JTA to execute the transactions. If we are using JDBC, I mean, non managed environment, "beginTransaction()" automatically takes care of setting the auto commit to false. In managed environment, with JTA, if we call "beginTransaction()" transaction will be created only if there is no active transaction in the current context. Hibernate will take care of ...