thread « Transaction « JPA Q&A





1. Thread deadlock blocked on Hibernate transaction    stackoverflow.com

I have one process which creates a database entity and then launches a second process. It then waits on the second process to find and update the database entity before ...

2. Reuse Hibernate session in thread    stackoverflow.com

I've read somewhere that when a session is flushed or a transaction is committed, the session itself is closed by Hibernate. So, how can i reuse an Hibernate Session, in the ...

3. how to make sure that hibernate committed a transaction?    stackoverflow.com

I've got a very weird behavior, in my java (spring) application, I've a case where i save an object using hibernateTemplate, then calling a thread which try to get this object ...

4. Hibernate Sessions and Transactions with Threads    stackoverflow.com

I'm working on a project that uses Hibernate3 and JDBC to connect/interact with our database (MSSQL 2008) Currently we create our session factory in our main class then begin our transaction, then ...

5. Running multiple JPA transactions in parallel    stackoverflow.com

I have two (or more) Java Threads creating, updating and deleting entities from a mysql database using JPA. To achieve this I have a PersistenceLayer class creating the EntityManager and providing ...

6. Two concurrent requests, same JPA entity - problems?    stackoverflow.com

Say my web server receives two simultaneous requests. It will handle each request in a separate thread. It will create a JPA entity manager for each thread. Now let's say each thread requests ...

7. Hibernate Thread BLOCKED lock SoftLimitMRUCache    liferay.com

Please help us with following issue. Thanks Liferay 4.4.2 JBOSS 4.0.5.GA Threads are getting BLOCKED during heavy load: hread: TP-Processor4311 : priority:5, demon:true, threadId:19088, threadState:BLOCKED, threadLockName:org.hibernate.util.SoftLimitMRUCache@12b1f80 org.hibernate.util.SoftLimitMRUCache.put(SoftLimitMRUCache.java:58) org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:122) org.hibernate.impl.AbstractSessionImpl.getNativeSQLQueryPlan(AbstractSessionImpl.java:137) org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142) org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152) com.liferay.util.dao.hibernate.QueryUtil.list(QueryUtil.java:57) com.liferay.util.dao.hibernate.QueryUtil.iterate(QueryUtil.java:52) com.liferay.portal.service.persistence.GroupFinderImpl.findByC_N_D(GroupFinderImpl.java:480) com.liferay.portal.service.impl.GroupLocalServiceImpl.search(GroupLocalServiceImpl.java:478) sun.reflect.GeneratedMethodAccessor470.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) $Proxy90.search(Unknown Source) com.liferay.portal.service.GroupLocalServiceUtil.search(GroupLocalServiceUtil.java:1342) com.liferay.portal.events.ServicePreAction.getDefaultLayout(ServicePreAction.java:310) com.liferay.portal.events.ServicePreAction.servicePre(ServicePreAction.java:924) com.liferay.portal.events.ServicePreAction.run(ServicePreAction.java:138) com.liferay.portal.events.EventsProcessor._process(EventsProcessor.java:132) com.liferay.portal.events.EventsProcessor.process(EventsProcessor.java:70) com.liferay.portal.servlet.MainServlet.service(MainServlet.java:613) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:98) com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:149) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) ...

8. Java Hibernate Thread Deadlock    forum.hibernate.org

Author Message pcooperuk Post subject: Java Hibernate Thread Deadlock Posted: Sat Dec 18, 2010 3:00 pm Newbie Joined: Thu Dec 16, 2010 4:52 pm Posts: 3 Hi, Am getting a Thread deadlock issue, 2 of them lock, the system seems to perform fine with them locked, but naturally want rid of them... I can't see anything in the below ...

9. Threads, concurrency, caching (re: nearly impossible to ...)    forum.hibernate.org

I am a new user of Hibernate: Following on from 'Nearly impossible to synchronize properly in Hibernate', with slightly different questions: To restate, optomistic locking is best, but deadlocks or stale objects exceptions must be detected, caught and (probably) re-tried. Are these obvious Hibernate exceptions which can be caught directly? I have a very large data set (across 5 tables) that ...





10. Concurrency problem with modifying same DO in diff. threads    forum.hibernate.org

Hibernate version: 2.0.3 Name and version of the database you are using: MySQL 4.2 HI, I've got a concurrency problem when I am modifying same DO in diff. threads with different hibernate session. Basically, both threads have their own hibernate session, both thread may update the DO based on the current state of the DO. However, when both threads loaded to ...

11. How to obtain two separate JTA transactions in same thread    forum.hibernate.org

I'm using JTA in my Hibernate application, and following the reference docs everything is working fine within JBoss. I'm wondering, though, how can I use two separate transactions (EG: bound to separate connections, so that commit() on one doesn't affect the other) within the JTA environment. Reading JTA docs I see that the UserTransaction is bound to the current thread, so ...

12. How to avoid thread deadlock?    forum.hibernate.org

Hi. The "APPARENT DEADLOCK" messages are coming from c3p0's thread Pool. They occur when all threads in the pool are running tasks that seem "hung" for some period of time. The thread pool eventually recovers by interrupt()ing, discarding, and replacing the threads. But for a time, performance is impaired (and if the tasks don't respond to the interrupt, allowing the thread ...

13. session deadlock when 2 threads access same tables    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.1.2 Mapping documents: A.hbm.xml and B.hbm.xml and AB.hbm.xml (many-many between A and B) All tables have ID (native) and version columns. Code between sessionFactory.openSession() and session.close(): trans = session.beginTransaction(); ADAO aDAO = DAOFACTORY.getADAO(); A a = aDAO.findById(id); BDAO bDAO = DAOFACTORY.getBDAO(); B b = bDAO.findByName(name); if(b== null){ b = new ...

14. using multiple transactions in multiple sessions per thread    forum.hibernate.org

Hibernate version: 2.1 Name and version of the database you are using: MSSQL wit jtds drivers and JDBC transactions Hi, I want to use multiple sessions generated from the same database and session factory to implement a application locking table. The locking table is used to block parts of my application from concurrent modification. It follows a quite simple approach: Fill ...

15. Sharing transaction in multiple Threads (and Sessions)    forum.hibernate.org

Hi all, In this scenario: - A CPU with N cores - some CPU-bound operation that can easily be split in N parallel jobs - need for repeatable-read or serializable transactions I would love to split the job to make use of multi-threading, but I have some transactional concerns: each thread needs to open it's own thread, but I would like ...

16. session per operation vs session per thread with autocommit?    forum.hibernate.org

In general is it considered bad form to use a Session without explicit transaction boundaries when using session per thread via getCurrentSession() ? ie. it's very easy to end up with closed sessions coming back from getCurrentSession if you use Session without explicit transaction boundaries because underneath the Session gets closed for you? Is that true? I have some code that ...