atomic « Transaction « JPA Q&A





1. JPA atomic query/save for multithreaded app    stackoverflow.com

I am in the midst of changing my JPA code around to make use of threads. I have a separate entity manager and transaction for each thread. What I used to ...

2. How to perform atomic operations in Hibernate?    stackoverflow.com

Hi
I have a hibernate entity which has a set of another entity as its field. Something like this:

public class UserEntity implements Srializable {
    private Set<Role> roles;
}
I should keep ...

3. Is JPA locking considered atomic?    stackoverflow.com

I am using Eclipse Link implementation, but maybe this is relevant also for Hibernate. At some point I called: em.lock(entity, LockModeType.OPTIMISTIC_FORCE_INCREMENT); Which I considered as an atomic operation. Surprisingly - after putting a breakpoint ...

4. Atomic operation with hibernate    stackoverflow.com

before write a record in db i have to do this task:

1- Read a max value of a field from a table
2- use this value to create new record
3- save the ...

5. Atomic operations    forum.hibernate.org

Hello, I have a problem with Hibernate with Oracle. I must create an atomic operation of SELECT + UPDATE for a unique field increment (i can not use Oracle sequence because i have some do some check in this field). So i would like to know if I can create an atonic operation for prevent other selects of other transactions before ...

6. Atomic operation    forum.hibernate.org

Hello, I need to send a SELECT than an UPDATE in a same transaction because it is something like a semaphore between servers, I would like to know how to do this with Hibernate (I'm newby of it). I have this configuration: Code: ...

7. Atomic operations    forum.hibernate.org

Hibernate version: 2.0 Suppose I have an entity called 'Account' with a primary key field 'username'. Now, a user wants to create an 'Account' so they submit their preferred username, say "Fred". How do I check if "Fred" exists, and if it doesn't, insert (Session.save) the Account? For example, consider the following code: Code: tx = session.beginTransaction(); if(session.get(Account.class, "Fred") != null) ...

8. is Session.flush() necessarily atomic?    forum.hibernate.org

Well, it's guaranteed to flush all outstanding operations in one lump, but it's only going to be DB-atomic if you're using a transaction. Transactions are recommended even if you're not interested in atomicity. Some people will recommend using transactions even for read-only DB access. In short: no, flush does not give you DB-level atomicity.

9. Atomic read & delete    forum.hibernate.org

Hi, I want to implement a mechanism where I can read a row from a table and lock it, then delete the row so that no other reads will see this row again, and each read is guaranteed to get a unique row. Here's what I've tried: Code: Criteria criteria = getCurrentSession().createCriteria(SomeClass.class); ...





10. save or update as atomic action    forum.hibernate.org

hi, im using hibernate and spring with declarative transactions: now i have an importer that persists a list of domainobjects: Code: @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public void doImport(List domains) { int count = 0; for (Domain d : domains) { ...

11. Could not execute JDBC batch update caused by Non-atomic bat    forum.hibernate.org

I have a back-end application which I use Hibernate 3.0 to persisting some object into a DB2 database, but sometimes I receive the following exception: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update When I check the cause of this exception I see: Caused by: com.ibm.db2.jcc.c.vd: Non-atomic batch failure. The batch was submitted, but at least one exception occurred on an individual ...