SELECT « Transaction « JPA Q&A





1. "SELECT ... FOR UPDATE" not working for Hibernate and MySQL    stackoverflow.com

We have a system in which we must use pessimistic locking in one entity. We are using hibernate, so we use LockMode.UPGRADE. However, it does not lock.

  • The tables are InnoDB
  • We have ...

2. immediate lock after read (Select for update)    forum.hibernate.org

3. Is opening a transaction necessary for select?    forum.hibernate.org

try{ session = get current session tx = session.beginTransaction() MyObject obj = (MyObject)session.get(MYObject.class, id); tx.commit(); return obj; }catch(HibernateException) he){ try{ tx.rollback(); }catch(HibernateException he){ } }finally{ close the session }

4. select queries and transactions    forum.hibernate.org

Hi all, I'm developing a project with hibernate and oracle and it works fine except for some strange blockings that appear performing select queries. As far as I know Oracle allows all kind of selects to be performed even when doing update operations on the same rows. It looks like some update operations are blocking even the select queries. I'm doing ...

5. Tables locked in Select Query - Editing of View    forum.hibernate.org

Hi All, I am using 1. Hibernate 3.1 2. Oracle 10g I am facing the following problems. 1. In my entire application I am only retrieving data from the database tables. I am not inserting or updating any data from the Java Code. My DBA has at times reported locking of tables and that the locks are released. I think ideally ...

6. Commit for a SELECT in HelloWorld? IMHO not a good move!    forum.hibernate.org

From here: http://www.hibernate.org/403.html I have concluded that you DO NOT need to demarcate a transaction around a READ operation (or many consecutive read operations). Hibernate suggests that you do this just to make things more complicated than they should. OF COURSE, if you are doing an WRITE (insert/update/delete) then you need a transaction, but my post is about a READ (select) ...

7. Using/avoiding SELECT..FOR UPDATE on a per-transaction basis    forum.hibernate.org

I have a general "how to approach this" question about a particular use of hibernate. I'm working on a web-application with Hibernate and seeing a lot of lock contention, which is causing both performance problems and occasional deadlocks. Part of the problem (the part that I'd like help on) is that Hibernate is always using SELECT...FOR UPDATE, which holds certain kinds ...

8. statistics about # of selects per session/transaction    forum.hibernate.org

is there a way to get the number of executed select statements per session (or per transaction) in hibernate? the stats returned from SessionFactory.getStatistics() are too global when I use them I cannot tell how many selects statements my current session has executed the SessionStatistics on the other hand work on the entity level, which seems to be too low of ...

9. Lock database record from select    forum.hibernate.org

my question is whether hibernate can provide some feature something like locking mechanism in which if we select one record from the database it will block the record by further accessing it and unless that guy modifies it and save that record or release it will remail blocked. scenario would be something like system access a record showing it to the ...





10. Using LockMode to lock selected records in a table    forum.hibernate.org

Hi, My 1st post so hoping to get a +ve reply as I have been Googling the whole day trying to solve this issue. My Setup: I have a table that is worked on by 3 apps: 1. App1: Inserts records into the table. 2. App2: Selects new data from the table on the basis of a status flag (=1) and ...

11. select ... for update (LockMode.UPGRADE not working)    forum.hibernate.org

I'm using Hibernate 3 with a MySQL 5.1 server. Hibernate seems to be ignoring my request to use pessimistic locking. I'm testing this by having two threads run the below code with different delays before and after reading from the db (thread 1: 1 sec then 4 secs; thread 2: 2 secs then 1 sec): Session session = HibernateUtil.openSession(); Transaction transaction ...

12. How to lock select to a table from many threads?    forum.hibernate.org