sql « Transaction « JPA Q&A





1. How do I ensure a value being updated with Hibernate hadn't been changed in the meantime since I read it?    stackoverflow.com

I have a problem where I want to read an object from the database using Hibernate, change a value, and save the object. If changing the value takes some time, what's ...

2. Updating counters through Hibernate    stackoverflow.com

This is an extremely common situation, so I'm expecting a good solution. Basically we need to update counters in our tables. As an example a web page visit:

Web_Page
--------
Id
Url
Visit_Count
So in ...

3. Execute some arbitrary sql in the current transaction in JPA 2.0    stackoverflow.com

I am new to JPA 2.0/EclipseLink/Glassfish/JEE6, and have kind of a basic question. I have a DAO in which most of the entities are mapped directly to columns using JPA annotations, so ...

4. java.sql.SQLException: Unable to obtain lock in 60 seconds    stackoverflow.com

I'm tracking this error for a while now, it hapens on irregular basis unpredictibly and I haven't find a way to reproduce it for now. Our environment

  • linux centos 5.3 hosting one ...

5. XA rollback doesn't rollback (SQL/JDBC/Hibernate)Exception    forum.hibernate.org

Hello, Using Hibernate 2.1.1, I am having trouble rolling back a transaction, when an error occurs, such as: Code: Caused by: java.sql.SQLException: ERROR: Cannot insert a duplicate key into unique index ix_uus_user_subscriber The trouble is that even though my code catches HibernateException and calls xa.rollback(), Hibernate (Session, I guess) still 'remembers' the last SQL statement, the one which caused the ...

7. SQL locking on VIEW using UNION over two tables    forum.hibernate.org

Newbie Joined: Mon Feb 07, 2005 10:07 pm Posts: 2 Hibernate version: 2.1.6 All I'm also posting this issue on the IBM developerworks db2 forum as I'm unsure where the problem lies : We're using Hibernate 2.1.6 in a J2EE app on Websphere 5.1 to access numerous DB2/400 files on our IBM iSeries running V5R2 using the JT400 v4.6 toolbox driver. ...

9. Multiple Transactions per Session, SQL not generated    forum.hibernate.org

Hi, I've developed a web based application which does NOT use the Transaction per request pattern nor JTA transactions. Instead my current session is obtained via plain JDBC. My current session and my currenct transaction are both bound to a ThreadLocal variables. My session is opened with a servlet filter and closed at the end of every request (I don't use ...





10. Executing native SQL within the same transaction    forum.hibernate.org

Good day, I have to execute session.save() and my stored procedure in the same transaction. My stored proc doesn't return resultset - it is used for update/insert. This sort of stored procs is not supported by Hibernate through native SQL queries. So, I use session.connection(). But apparently, my stored proc is NOT executed in the same transaction. Am I doing something ...

11. Using Hibernate and SQL DAOs in the same transaction.    forum.hibernate.org

Hi, I'm developing an application that uses hibernate to make the CRUD operations and SQL DAOs to make some lookups and complex selects to the database. The hibernate uses one datasource and the DAOs uses another one. There some situations where I need to call one or more DAOs inside an Hibernate transaction, for exemple to validate a data against a ...

12. commit; not seen in generate sql.    forum.hibernate.org

14. update() + named sql query in same transaction?    forum.hibernate.org

try { sessionFactory = com.tracker.db.SessionFactoryHelper.getSessionFactory(); currentSession = sessionFactory.openSession(); manager = new KeywordManager(currentSession); currentSession.beginTransaction(); //Perform updated currentSession.getTransaction().commit(); } catch (org.hibernate.StaleObjectStateException e) { currentSession.getTransaction().rollback(); //Synchronize object with newer version in database } catch (Exception e) { if (currentSession != null) { currentSession.getTransaction().rollback(); } } finally { if (currentSession != null) { currentSession.close(); } }

15. SQL Deadlock or starvation problem    forum.hibernate.org

Hi all, I need your help. I have pretty hudge project based on hibernate, and my problem is, that after few hours/days sometimes only minutes all threads are waiting for connect to database, and server needs restart. I think problem is for sure in some deadlock in database, because after restarting of application server the problem persisted. I tried ti restart ...