begin « Transaction « JPA Q&A





1. Hibernate :session and begin transaction in the constructor of the abstractDao    coderanch.com

Hi All, I wanted to know your thoughts on this one. We are using a genericDao. All Dao's used as part of the application will inherit this genericDao. I was trying to modularize as much code as possible in this generic dao. In the constructor of the genericDao I am planning to keep the fetch session and begin transaction calls. ------------ ...

2. Hibernate transaction begin stuck    coderanch.com

Dear all In my web application , I write a hibernate transaction filter as below public class HibernateSessionRequestFilter implements Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { Transaction tx = null; try { logger.warn(HibernateServiceImpl.getCurrentSession()); tx = HibernateServiceImpl.getCurrentSession().getTransaction(); if (!(tx != null && tx.isActive())) { tx.begin(); } chain.doFilter(request, response); if (tx != null && tx.isActive()) { ...

3. HELP!!! Hibernate can't begin transaction.    forum.hibernate.org

org.hibernate.dialect.MySQLDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/mydatabase myusername mypassword org.hibernate.context.ThreadLocalSessionContext ...

4. Transaction Begin stuck    forum.hibernate.org

Dear all In my web application , I write a hibernate transaction filter as below Code: public class HibernateSessionRequestFilter implements Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { Transaction tx = null; ...

5. Begin transaction on a closed connection    forum.hibernate.org

I am using cdo, on top of teneo on top of hibernate on top of postgresql. After a tcp connection close (hibernating my laptop) I ran into an exception which seemingly means that hibernate tries to begin a transaction on a closed db connection (see at bottom). I was looking for the issue in the bugzilla, there was one similar bug ...

6. Why need I have to begin transaction using "getCurrentS    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.1.3 ........... Session s=HibernateUtil.getHibernateCurrentSession();//openSession(); //Transaction t=s.beginTransaction(); User u=(User)s.get(User.class, new UserId("sfd","sdf")); System.out.println("Get: "+u); //t.commit(); 2006-08-07 ...

7. 'SQLOLEDB' was unable to begin a distributed transaction    forum.hibernate.org

I am refering to two tables both in different databases in my stored procedure. hibernate.connection.url is pointing to the database which has the stored procedure. When I execute the sp directly in the database it is executing without any error, but when I execute it through my application it throws following error 19:37:13,109 WARN [JDBCExceptionReporter] SQL Error: 7391, SQLState: S1000 19:37:13,109 ...

8. Where do I begin transaction and commit    forum.hibernate.org

You should begin the transaction before your "unit of work" starts. Typically this is outside of the DAO. Consider this example unit of work... you want to delete a user, delete their preferences and write a log entry to the dabase. These must all happen within the same transaction but would probably use separate DAOs for the different operations. Hence, start ...

9. should i use begin and commit for each hibernate call ?    forum.hibernate.org

i have no problem executing hsql like below , but after my app run for few hours, i get exception at the bottom. is it because i didnt use "begintransaction" and commit in my query method ? my example query:::::: Criteria crit = sess.createCriteria(TheObject.class,"table_name") .addOrder(bSortOrder ? Order.asc(sortColumnId): Order.desc(sortColumnId)) .setFirstResult(nFirst) .setMaxResults(nPageSize); random exception after app run for many hours:::: ARNING: Template for ...





10. Repeated calls to Transaction.begin()    forum.hibernate.org

public class HibernateSessionManagerImpl implements HibernateSessionManager, ThreadCleanupListener { private final Session session; private Transaction transaction; public HibernateSessionManagerImpl(HibernateSessionSource source) { session = source.create(); transaction = session.beginTransaction(); } ...

11. Error when begin transaction    forum.hibernate.org

I save object with the following code: public boolean saveAndUpdate(TblCustomerInfo customerInfo) { Session session=getHibernateTemplate().getSessionFactory().openSession(); try{ Transaction tx=session.beginTransaction(); session.saveOrUpdate(customerInfo); tx.commit(); if(tx!=null){ try{ tx.rollback(); } catch(HibernateException ex){ ex.printStackTrace(); } } } catch(HibernateException ex){ ex.printStackTrace(); } return true; } But it give the error: org.hibernate.TransactionException: Transaction not successfully started at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:149) at com.callcenter.dao.impl.CustomerManagerDAOImpl.saveAndUpdate(CustomerManagerDAOImpl.java:73) at com.callcenter.service.impl.CustomerManagerImpl.saveAndUpdate(CustomerManagerImpl.java:38) at com.callcenter.web.pages.EditCustomer.onSuccess(EditCustomer.java:26) at com.callcenter.web.pages.EditCustomer.dispatchComponentEvent(EditCustomer.java) at org.apache.tapestry.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:843) ............ and i ...