Help « Transaction « JPA Q&A





1. Help with a reusable JPA transaction method w/ rollback    stackoverflow.com

I am retro-fitting transaction rollback support to a JPA-based java application, and am using Ecmel Ercans's approach to handling rollback (http://weblogs.java.net/blog/davidvc/archive/2007/04/jpa_and_rollbac.html) and JPA's kinks connected to rollbacks. It looks ...

2. [EJB3 JPA] Help with locking    coderanch.com

3. JPA 2.0 Casecade implemenation for Hibernate JTA transactions - Please help me    coderanch.com

I am using JPA 2.0 and Hibernate JTA transactions. I am having a problem when trying to insert row on a one to many relationship: my parent Class: public class UserPreference implements Serializable @OneToMany(mappedBy = "userPreference",fetch=FetchType.EAGER,orphanRemoval=true) @Cascade(value={org.hibernate.annotations.CascadeType.ALL}) private Set userHeaders; // child class reference Child Class: public class UserHeader implements Serializable @ManyToOne @JoinColumn(name="user_sr_id") private UserPreference userPreference; (Master reference) When I try ...

4. HELP! optimistic locking doesn't work with null version    forum.hibernate.org

I have an existing table that i am introducing a new column to handle optimistic locking. This column is incremented via a trigger. However since my table currently has many records i am not populating existing records with a version column value. I have defined my mapping as such: What i find is that optimistic locking ...

5. Need help with locking    forum.hibernate.org

I've been trying to learn more abount the new lock capabilities in JPA2. I'm reading [url=http://weblogs.java.net/blog/2009/07/30/jpa-20-concurrency-and-locking]Carol McDonald's[url] article. Unfortunately I'm unable to run any of the example given by Carol in this article. Trying to reproduce the example given in figure 2 I've written the following code: Code: public class Main { public static void main(String[] args) ...

6. help with transactions    forum.hibernate.org

hi, im trying to get transactions to work but either I missed something very important in the docs or I dont know whats going on.. anyways heres the code im trying to run, i was expecting an ObjectNotFoundException to be thrown when trying to load the object at the end but its not happening, please help! Session session = HibernateSession.currentSession(); session.setFlushMode(FlushMode.COMMIT); ...

7. HELP! Problems with transaction.    forum.hibernate.org

I'm using Hibernate 2.1.1. I want to deploy Hibernate as a MBean (SAR) in JBoss 3.2.3. Here's my jboss-service.xml for the SAR: Code: jboss.jca:service=RARDeployer ...

8. Please HELP, concurrency problem    forum.hibernate.org

is my request not well explained ? need more details ? system with two applications, one application add data by a call to save and the second get data by a call to find function The second call to find() does not find the new data ... that are stored into database is it a cache error ? how does find() ...

9. lock contention issues, help with transaction/concurrency    forum.hibernate.org

Newbie Joined: Thu Jun 03, 2004 8:57 am Posts: 8 (originally posted this under "tools" by mistake, sorry) Our application has just run into speed and low memory issues, since we have recently added more data (a little less then doubled the size of our db) to the system. SQL Server 2000 is being brought to its knees, and CPU on ...





10. Need help about Transaction    forum.hibernate.org

You may want to check the Spring framework. That will give you the opportunity to use declarative transactions instead of separating them programatically. Another solution is to have 2 different layers let's call them service and DAO. In services you would explicitly commit/rollback transactions while in DAO you will not have any transaction code. Passing the connection can be done with ...

11. Transaction problem, please help    forum.hibernate.org

Read the rules before posting! http://www.hibernate.org/ForumMailingli ... AskForHelp [b]Hibernate version:3.0[/b] [b]Mapping documents:[/b] [b]Code between sessionFactory.openSession() and session.close(): ....... try { session = HibernateUtil.currentSession(); Query query = session.createQuery("FROM User u where u.name = :name AND u.password = :password"); query.setParameter("name", new String(name)); query.setParameter("password", new String(computePasswordHash(password))); user = (User)query.uniqueResult(); Date today = Calendar.getInstance().getTime(); if (user != null) { setName(user.getName()); setDescription(user.getDescription()); setPassword(user.getPassword()); setIsAdmin(user.isIsAdmin()); setLoginDate(user.getLoginDate()); setLockedDate(user.getLockedDate()); ...

12. HELP!!!! about flush() and commit()    forum.hibernate.org

Version: Hibernate 3.0.5/3.0.4, I can't save my data into database when only use session.flush(), actually, when I run the programe in DEBUG mode and DEBUG it step by step, I can see that there is one record which has been inserted into my tables, but when DEBUG was terminated, the record I saw before had been deleted as well.(there is no ...

13. need help with jta transaction and servlets    forum.hibernate.org

hi, what do i use: hibernate 3.0.5 jboss 4.0.3SP1 java 5.0 os: linux 64 Bit mappingfiles, i can send them by email, but they are ok. I working with them for a while in a SWT Application. Right now we transport the Apllication to ECHO (Web Framework based on Servlets) my code: Context context = Bellerophon.getApp().getContext(); UserTransaction transaction = (UserTransaction) context.lookup("java:comp/UserTransaction"); ...

14. Deadlock found when trying to get lock. pls help me !    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:2.1.7 Hi, i have one to many relation with employee to attendance. one employee can have many attendance time in a office. and my database is mysql where checkin and checkout is datetime type. when i going to update checkout field of a particular attendance object then there is exception ...

15. Config: use_identifier_rollback doesn't work. Need Help...    forum.hibernate.org

Hibernate version: 3.05 and 3.1.1 Configuration documents: Code: org.postgresql.Driver test ...

16. Problems with JTA, please help me    forum.hibernate.org

If your persistence layer runs in an application server (e.g. behind EJB session beans), every datasource connection obtained by Hibernate will automatically be part of the global JTA transaction. Hibernate offers two strategies for this integration. If you use bean-managed transactions (BMT) Hibernate will tell the application server to start and end a BMT transaction if you use the Transaction API. ...





17. Need Help transaction Not supported with Informix9.4, hiber3    forum.hibernate.org

Hi I am using Hibernate 3 with JDK1.5 and Informix 9.4 and driver version 2.21JC5 But it shows the error seems not support informix9.4 The Error is org.hibernate.exception.GenericJDBCException: Cannot open connection at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:301) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110) at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:137) at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:49) at org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:24) at org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:271) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1079) at com.pa.cricket.daoimpl.PlayerDAOImpl.findAllPlayers(PlayerDAOImpl.java:46) at com.pa.cricket.bl.Test.main(Test.java:31) Caused by: java.sql.SQLException: Transactions ...

18. Help. ConcurrentModificationException on commit    forum.hibernate.org

Newbie Joined: Wed May 03, 2006 12:18 pm Posts: 1 Location: Chile Hibernate version:2.0 Mapping documents:not provided code: protected void saveObject(Object objeto) throws ABMException{ Session session = null; Transaction trx = null; try { session = SessionController.getSession(); trx = session.beginTransaction(); session.save(objeto); trx.commit(); <---------- here, the execution fails. }catch (Exception e) { logger.error("save error: "+ objeto.getClass().getName()+" - Cause: " +e.getClass()+": " + ...

19. need help solving cacheing and concurrency problem    forum.hibernate.org

Hi there. So first the stats: hibernate 3 jboss 4.0.2 postgresql 8.1 java1.5 I switched my transaction management to CMT a few months ago, and since then we've had this recurring problem (maybe once a day) where the cache becomes "corrupt" and needs to be flushed to continue working. By corrupt I mean this: object A has a collection of B's ...

20. Problem With Optimistic locking - Please help    forum.hibernate.org

In order to make hibernate do the Optimistic Locking we are setting the optimistic-lock="version" and the attribute in the configuration xml (cfg.xml). If there is an optimistic-lock value set and when user tries to modify and save a record, in the update statement generated by hibernate, it will put a where clause with the timestamp column (column name mentioned in ...

21. Need help with versioning on optimistic locking mechanism    forum.hibernate.org

The version no. of the persistence object will be automatically incremented in optimistic locking mechanism. But the version column is fixed length integer or long, so what is the behaviour when the value of version column reach maximum (e.g. One record has been modified for many times)? Will Hibernate handle this case or just let the exception "Value is too large ...

22. Lock/refresh nighmare, please help    forum.hibernate.org

Hello everyone, I have a very simple problem, but I have not found an easy solution. This indicates that i must be doing wrong : I want to lock an object with a LockMode.UPGRADE lock, then read the object attributes, as they are in the DB. This should translate into one query : select * from .. where id=.. for update. ...

23. locks/concurrent transactions - sessions - Help please    forum.hibernate.org

I am new to hibernate and was trying out few things and was wondering how locks can be implemented using hibernate... Say if i have two threads trying to update the data (same row in database) using different sessions...and if one of the thread updates the data in that row after other threads gets the data...how do i make sure other ...

24. Need help in understanding hibernate and JTA transactions    forum.hibernate.org

Hi all, I have a question regarding the JTA transaction manager behavior with respect to hibernate. I have an application with Spring and hibernate running on JBOSS. The Spring is configured to use JTA transaction manager of JBOSS. Also, we are using OSCACHE as the second level cache for hibernate. The issue we are currently facing is in some environments (Testing, ...

25. Want help regarding optemistic locking using version    forum.hibernate.org

Hi All, I am new to hibernate Ineed some help regarding Optimistic locking using version. I have implemented this in one of my project ,What I want is I need to check this implementaion wether it is working correctly or not in my project. I want to know the procedure to check this and how to get that stale object exception. ...

27. Amateur help on concurrent Sessions    forum.hibernate.org

Hello everyone, I've been reading all the documentation about Sessions, Transactions and Concurrency and I believe I have a good understanding about it. But I can't seem to understand one thing. Can you have two or more opened Sessions? One per thread, not shareable between different threads, or the idea is that you only have a single one and you lock ...

28. Can you help me fix this transaction/hibernate session prob?    forum.hibernate.org

Hi, I am having a problem using Spring's test framework with Hibernate sessions. Because of the way spring's transactions work, the tests will do things that actually DO NOT occur in the real, production environment. For example * Hibernate will not throw LazyInitializationExceptions when I'm testing controllers... but once in the real application, they are thrown. I want to know this ...