rollback « Transaction « JPA Q&A





1. Hibernate rollbacks    stackoverflow.com

If I do the following session.getTransaction().rollback(); is it then ok/possible to start calling save/update/delete etc. on the same session object? Couldnt find the answer to this in the Hibernate Session/Transaction ...

2. ApplicationException - Java - Hibernate - rollback related    stackoverflow.com

My question is related to Transactions and Exceptions Requirements: I have 10 records to insert into database table. And after inserting every record, I insert data into another table. So if inserting to ...

3. JTA Transaction doesn't rollback Hibernate sessions    coderanch.com

Hibernate version: V2.1.6 Name and version of the database i am using : Oracle 8 JBoss : V4.0.0 I have configured Hibernate in JBoss through .har deployer and get the session by the JNDI to the session factory. All working fine except for Transactions. I use JTA and have given my Transaction demarcation in the deployment descripter of my stateless session ...

4. Rollback not working in Hibernate    coderanch.com

Hi All, In my code i am doing some updates in group. What i have to do is if during any updation if there is some exception, the previous save should rollback to old data. This thing is not happening.Eg:- Here I am purposely throwing exception at 4th update to check if the previour 3 updates are rollbacked or not. They ...

5. Problem with rollback    forum.hibernate.org

Hi, i'm trying to save two objects using the save method on the same session, the first object is violating a constraint on database, after it raises an error i rollback the transaction and try to save the second object, when i call the save method for the second object, i'm getting the same error as i was before, its like ...

6. Transaction Rollback    forum.hibernate.org

U may have ur Hibernate Session configured to auto commit (not the hibernate session itself but the underlying jdbc connection): true switch it to false. Also, try to have a handle on the transaction instead of using the getTransaction() method so that u know exactly what transaction u are dealing with (depending upon how its configured u might have received ...

7. Rollback not working with createQuery    forum.hibernate.org

I'm having trouble with rollbacks not getting rolled back. I'm using hibernate3 with mysql. I have a simple table, call Person, it only has one column, which is the person's name. This is the stripped down version of the code Im using: Code: SessionFactory factory = HibernateConfiguration.getSessionFactory(); Session session = factory.openSession(); session.beginTransaction(); Person p1 = new Person(); Person p2 = new ...

8. Wierd automatic rollback of Hibernate on Myism    forum.hibernate.org

Hi guys, I am relatively new to Hibernate and have used it on my sites for last couple of weeks. Recently, I have found out a weird rollback problem om select of Hibernate on 5.1 Myisam database. If I have two processes, each opens a hibernate session to my db. One did update successfully on a row. Within a few seconds, ...

9. Session.clear() in rollback()    forum.hibernate.org

Hi guys, Why method TransactionImpl.rollback() calls Session.clear() ? I mean, I'd like to keep my first level cache even after rollback and it's not happening. public void rollback() { if ( tx == null || !tx.isActive() ) { throw new IllegalStateException( "Transaction not active" ); } try { tx.rollback(); } catch (Exception e) { throw new PersistenceException( "unexpected error when rollbacking", ...





10. JPA transcation rollBack is not working    forum.hibernate.org

config.xml PROPAGATION_REQUIRED

11. Hibernate Transaction rollback Doesnot work    forum.hibernate.org

Hi, 1. I am working on a project, where it make use of LDAP and mysql for storing user records.In my case, when a user registers,some details go and sit into mysql and some into LDAP. 2. In this scenario,the save happens first in mysql then into LDAP, but in case there is any exception/error occurred during saving to LDAP, the ...

12. Recording Rollback Script-File possible?    forum.hibernate.org

Hi, I've got a Java programm using Hibernate which persists some stuff in a database. Now I want a logfile which gives me the opportunity to manually rollback all the changes my programm made in the database. Is there any way to tell Hibernate to record/log a rollback SQL-file (should contain rollback SQL statements)? Thx a lot.

13. hibernate transaction rollback problem    forum.hibernate.org

Hi, my problem is with transactions. When i do call to deleteLocationsOfUser(3) the query execute inmediatly and never I can do rollback to transaction. The code is: @SuppressWarnings("unchecked") public int deleteLocationsOfUser(final Long locid){ int del = hibernateTemplate.execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { SQLQuery query = session.createSQLQuery("delete from LOCATION where LO_ID = :locid"); query.setLong("locid", locid); int del ...

15. What is the correct way to rollback?    forum.hibernate.org

No. I think what you really want is savepoints. Its actually reasonably easy to add this feature to Hibernate. (As a hack solution, you could serialize the session and then deserialize it from rollback.) Just chatting with Christian and David here, we're not really convinced that savepoints are such a great thing.....

16. Multiple transactions using the same session and rollback    forum.hibernate.org

Hi all, A have a question regarding the use of transactions. Is it safe to have several (non simultaneous) transactions in the scope of the same session ? I have serched the forums and the first conclusion would be - yes, it is possible - but we have a problem which we are thinking is related to this issue. The problem ...





17. JTA transactions and rollback    forum.hibernate.org

Hello, I'm using hibernate 1.2.5 with weblogic 6.1 SP5. I'm using JTATransactionFactory as a tx factory. I've got a scenario in which I am saving an object from the web application (not within an EJB). I start a transaction, then encounter an error when saving some objects to the database. My error handling code calls tx.rollback(). However, the transaction ends up ...

18. Rollback changes    forum.hibernate.org

I think it's a really common question but i cant find it in the forum. In my my webapp, I load an entity with HibernateFilter.getSession().load(myClass, id). My entity is then populated by some input parameters. Afterwards, my entity is validated. In case of errors, i would like to "rollback" the changes, I dont want when my session will be closed, the ...

19. Rollback transaction, rollback bean    forum.hibernate.org

In a web MVC architecture you have a "Form Bean" which is the transport from the UI to the Model. These beans usually have a lifespan of the request scope. My problem is with a (Swing) desktop, I create a UI to edit a hibernate model bean. The user edits the fields, simple validation is done when they click save, then ...

20. Transaction.rollback() does not work?    forum.hibernate.org

Hiya. I'm having some trouble rolling back a transaction - it fails to work as expected. In my code, I'm reading in a bunch of data and creating a set of persistent objects. Sometimes the data is malformed, and the import utility tosses an IllegalStateException. I catch the exception and roll back the transaction, but look in the database and see ...

21. java.lang.NullPointerException at rollback    forum.hibernate.org

I am using Spring for transaction management in my application, more precisely TransactionProxyFactoryBean proxy. Calling service methods I succed to call dao methods within a single transaction, it commits and rollbacks correcly at database level, but at rollback, my dao object throws a NullPointerException. Other strange thing: when an exception is thrown from a dao method and rollback must be called, ...

22. transaction rollback ?    forum.hibernate.org

hibernate version 2.1.2 db : mysql (oracle) For this very simple PO example, first under the transaction control with spring when i want to insert record with value(80,800) which the key is duplicate with the existed record (80,XXX), the result throws java.sql.BatchUpdateException,then i got rid of sping control with all hibernate code which is under here, it also throws java.sql.BatchUpdateException, but ...

23. Removing bean after rollback    forum.hibernate.org

24. how to use rollback ?    forum.hibernate.org

hi, guten tag. i am a java intermediate programmer. i have a bit of Hibernate code , i am wondering how people call Transaction.rollback(). i tried to do the same, Java class will not compile. code is: Session s; Transaction t; try { get session; //using HibernateUtil class start transaction; add to table via bean etc.. etc.. transaction.commit(); } catch (Exception ...

25. Logical Unit of Work Rollback    forum.hibernate.org

Hi, I'm having problems rolling back my entire transaction. One of the update statements generates an SQLException which I trap and then rollback. Rolling back doesn't roll back the entire transaction, however. Only the failed update. Can someone help? Here's what my code looks like: Transaction t = null; Session s = null; try { s = openSession(); // thread local ...

26. Failing to Rollback?    forum.hibernate.org

I'm using Hibernate 2.1 with MySQL with InnoDB tables (though I've seen the same behavior with Oracle 8.x). The problem I'm having is with transactions not rolling back. My Servlet Engine is Tomcat 4. in hibernate.cfg.xml I've set: Code: net.sf.hibernate.transaction.JDBCTransactionFactory My java code looks like: Code: try { transaction = ...

27. Trouble with transaction.rollback()    forum.hibernate.org

This may be a trivial issue that I am overlooking. I have a saveOrUpdate() being wrapped in a net.sf.hibernate.Transaction object. There is a one-to-one relationship between my Order object and the PaymentInformation object. The authorizationCode in the PaymentInformation is required and since it is not present, I encounter an exception, which is the desired behavior. However, when I call rollback, the ...

28. Transaction rollback doesn't work, why?    forum.hibernate.org

Author Message steinkel Post subject: Transaction rollback doesn't work, why? Posted: Thu Aug 26, 2004 11:51 am Newbie Joined: Tue Jul 20, 2004 7:03 am Posts: 19 Location: Spain Hi all. I'm doing a simple transaction test case, the objective is 1. Save two objects, one simple, one complex 2. Before committing the transaction, hit rollback 3. Test these ...

29. Session.saveOrUpdate() versus Transaction.rollback()    forum.hibernate.org

I've noticed that even if I do transaction.rollback() after a Session.saveOrUpdate(), the changes don't seem to roll back. Does this imply that saveOrUpdate() commits a transaction and moves the "checkpoint" position to the current position? Is there anything else that could be going on which would explain why invoking Transaction.rollback() would not prevent from changes to the underlying database? I don't ...

30. Transaction rollback    forum.hibernate.org

Thanks for the help guys. The reason that I have to commit the first transaction is that it does not seen to give the lastest sequence number (DB trigger generated) of Table1 unless it is commited. This sequence number is needed for the second transaction. I guess I have to use JTA then. Thanks for the help !!!

31. Transaction rollback    forum.hibernate.org

I have a need to update one table based on previous transaction result. However, if the update failed, the previous transaction should rollback. I have the following code trying to do so but it does not seen to work. Any help is appreciated. ------------------------------ Hibernate version:2.01 Mapping documents: Code between sessionFactory.openSession() and session.close(): // get a hiberate open session Session session ...

32. rollback after ObjectDeletedException leaves session broken    forum.hibernate.org

Hibernate version: Hibernate 2.1.4 Name and version of the database you are using:HSQLDB server 1.7.1 is running When I want to remove an object through session.delete(obj) and it's still associated in my application Hibernate throws an Exception (net.sf.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade). This is exactly what I want, because then I do a rollback on the transaction and ...

33. commit following previous rollback    forum.hibernate.org

Hibernate version: 2.1.6 Code between sessionFactory.openSession() and session.close(): tx.beginTransaction() loop: session.save() session.flush() session.clear() throw exception tx.rollback tx.beginTransaction() save logs to database tx.commit() Name and version of the database you are using: Oracle 8i Hi, Hopefully the above pseudo code is clear enough. What I'm seeing is that after doing a bulk insert (with flush and clear every 30 saves to reduce ...

34. Multiple rollbacks and commits in a single transaction    forum.hibernate.org

Hello, i am having problems using a single transaction and having multuple commits and rollbacks with the rollbacks rolling back previous commits. I have even set the flush mode to commit but still the rollbacks rollback my previous commits. ok this is what i am trying to do: get a list of Xobjects with hql go thru each one of them ...

35. How to rollback?    forum.hibernate.org

wrap it within a transaction. something like this: Code: Session hibernateSession = null; Transaction transaction = null; try { if (orderType != null) { hibernateSession ...

36. Transaction rollback    forum.hibernate.org

I want to make sure I am handleing transactions properly. I was hoping to find an SLSB example in caveat emptor (using the hibernate integration code, but I didn't see any). Right now I'm basically doing this inside an SLSB method: Code: Transaction tx = null; try { Session sess = ...

37. Howto Rollback? (Cannot rollback during a managed transactio    forum.hibernate.org

Hibernate version: 2.1.6 Name and version of the database you are using: Oracle 8i Hi all, I am doing just a simulation operation in my db, and after the process i need to rollback all that was generated: Code: public Object simulate(...) { Object ret = null; Connection con = null; Transaction trans = null; ...

38. Transaction: rollback, commit    forum.hibernate.org

Sorry, im a relative newbie to hibernate. My service is behaving a little strange. Here are the sequence of events 1) Save an object (create session, session.beginTransaction, transaction.commit(), session.close) 2) Save a 2nd object, whichcauses an exception, because of a unique constraint I have on one of the table columns (create session, session.beginTransaction, EXCEPTION THROWN, transaction.rollback, session.close) 3) Save a 3rd ...

39. Transaction.rollback() and    forum.hibernate.org

Hi, I have a question regarding the way tx.rollback() works. In the following code, I create a new message and it persists to the database when I commit. In the second transaction I change the value and then roll back, so it doesn't save the change to the database. What I'm looking for is to restore the message object back to ...

40. transaction commit and rollback    forum.hibernate.org

Hibernate version: 2.1 Mapping documents: ...

41. Rollback does not seem to work.    forum.hibernate.org

42. Transaction management - rollback isn't performed    forum.hibernate.org

Newbie Joined: Mon Jun 20, 2005 9:25 am Posts: 4 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0 Borland Enterprise Server 5.2.1 Oracle DB 9. something I get mysterious results when testing transaction management in a managed (CMT) environment. I have prepared an objectstructure which will cause an error when inserted into the database. hibernate.cfg.xml: Code: ...

43. Native identifier generation and transaction rollback    forum.hibernate.org

Does use of the native identifier generation cause a commit to the database even when the connection's autocommit is set to false? When doing a save on an entity inside a transaction, it gets saved to the database even when I invoke rollback instead of commit. Hibernate does an insert to get the database-generated identifier, but that insert is not undone ...

44. Transaction rollback does not work    forum.hibernate.org

I use the session.beginTransaction() to start a new transaction. After I save an object, and call transaction.rollback(), it works fine. But if I try to run some query before that, the object is saved into database regardless I called rollback() or commit() later. I'm using JDK1.5.0, Hibernate 2.1.7 and MySQL 4.1 Thank you for your help! The code: ======================================= Properties cp ...

45. HiA Chapter 8 doFilter - what abbout rollback    forum.hibernate.org

Hi; In HiA page 304 it shows how to use doFilter to commit and close a session. And all the associated code then shows no try/catch for hibernate exceptions. But unless I'm missing something, if a hibernate call throws an exception (say an update on a record that is no longer in the DB), don't you need to catch it and ...

46. tx.rollback doesn't seems to work    forum.hibernate.org

47. Explicit transaction rollback    forum.hibernate.org

public class HibernateDataAccessObject extends HibernateDaoSupport implements IDataAccessObject { public void rollback() { // (1) this.getSession(true).getTransaction().rollback(); // (2) this.getHibernateTemplate().getSessionFactory().getCurrentSession().getTransaction().rollback(); }

49. transactions disapearing - Rollback implicit    forum.hibernate.org

Friends, I developed an system to import data from a text file. Each transaction store sales information in one table and sale itens in another. I have foreign key between then. These information are in one object that have sale information itself and collection with sale itens. I open a new hibernate transaction, save my object (sale) and commit it. I ...

50. rollback probs and other    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.0 Name and version of the database you are using: MySQL 4.1.14 (InnoDB Engine) Hi, I'm a relatively new hibernate user so it's possible i'm doing something wrong - sorry for that. I have several probs with hibernate: (1) a rollback probem I need to save objects with unique names ...

51. Hibernate do a rollback strangely    forum.hibernate.org

Hello I begin in hibernate and try some exemple : here is the java code I use to record an object : SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); Session session =sessionFactory.openSession(); // org.hibernate.Transaction tx = session.beginTransaction(); Users user = new Users(); user.setLogin("marcel"); user.setPassword("toto"); session.saveOrUpdate(user); //tx.commit(); session.flush(); session.close(); the point is the if I don't use transaction commands (here commented) the insert request ...

52. Auto Rollback?    forum.hibernate.org

53. Rollback doesn't work with JTA transaction    forum.hibernate.org

Hi ! I have a problem with transactions that does not rollback as expected. I'm using Hibernate with JTA inside a Jonas container. I have several transactions done in the same hibernate session. If a transaction rollback and the next one commit, both are commited ! In the following example reproducing the problem, I use JTA transaction demarcation (but the problem ...

54. transaction rollback    forum.hibernate.org

thanks for the quick reply. Just to state my opinion about this, I think it is completely against the "units of work" idea. If I perform some modifications (in this case, save an object to database) in context of a transaction, and then rollback the transaction, I would expect that modification to be undone. Do you think that performing a flush ...

56. Transaction Doesn't Rollback    forum.hibernate.org

57. strange things after rollback    forum.hibernate.org

Code between sessionFactory.openSession() and session.close(): Session s = SessionFactoryHibernate.getCurrentSession(); Transaction tx = s.beginTransaction(); Flight fli = new Flight (); fli.setFlightName("boy747"); s.save(fli); System.out.println("new id="+fli.getFlightId()); tx.rollback(); //If I use "load" first , and then clear, and then "load" or "createQuery", I cannot find the boy747 object. But If I use "createQuery" first , and then clear, and then "load","createQuery" , I still can ...

59. Transaction Rollback problem    forum.hibernate.org

Hibernate version : 3.2.0cr Database MySql 5.0 I am using two tables with one class using join table in mapping file. The two tables are in different database enginge in MySql In exception, the rollback statement is working fine for main table, but it is not working for join table. Please give me the solution for this. Thanks in advance

60. What happens with Hibernate session after a rollback?    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp [b]Hibernate version:3.1.1[/b] Read this: http://hibernate.org/42.html Hi all, I have a problem regarding the using of the same Hibernate session across transactional methods. I thinks this issue is related to another one posted in Jira: "HHH-511" When occurs an exception in a transactional method, the Hibernate session associated seems to be cleared, ...

61. What might cause rollback() in hibernate2 to do nothing?    forum.hibernate.org

I've got a big inherited application, and lo and behold, rollback() and transactions don't work. I doubt anyone can solve the problem for me, but where can I at least look? How might these transactions get committed? I do something simple like: Code: object.setSomething("test " + new Date); mySession.rollback(); And yet the data gets committed. The rollback implementation is: ...

62. Transaction rollback does not work iwth hibernate3    forum.hibernate.org

Hi, Following iss my code snippet. I m trying to add 2 SmhostBean objects with id 1 and id 2. The id is the primary key here. I m adding them in the same transaction. But id 1 already exists in the Db.si its insertion the second time should throw an exception whithc it does. But what i obsever is that ...

63. Transaction rollback does not work iwth hibernate3    forum.hibernate.org

Hi, Following iss my code snippet. I m trying to add 2 SmhostBean objects with id 1 and id 2. The id is the primary key here. I m adding them in the same transaction. But id 1 already exists in the Db.si its insertion the second time should throw an exception whithc it does. But what i obsever is that ...

64. Hibernate Rollback does not work    forum.hibernate.org

65. transaction.rollback() after saveOrUpdate    forum.hibernate.org

66. doubt in rollback    forum.hibernate.org

hai, i have doubt in rollback concept.pls clear my doubt. first i saved the data in the session, then i rollback again, sothat the data are not stored permenently in the database. its workking fine. but my question is the data are not rollback in the class ie(User class). when i print the last inserted id from the class, it print ...

67. Transactions and rollback    forum.hibernate.org

I am writing a web application which uses hibernate. I've figured out that it is going to change objects only in a few places which I can handle specially. In most cases, it would not modify objects during request handling. In some cases it would modify objects, but I don't want those changes to be persisted - sort of preview mode, ...

68. Session flushes even when transaction is marked for rollback    forum.hibernate.org

1. I submit a form from one of the web pages. 2. In the business layer of my application, some of the persistent domain objects are modified and after some processing but before issuing a hibernate save/update on those domain objects, some business rule is violated and an exception gets thrown. 3. On the way out of the business layer, Spring's ...

69. Hibernate does not rollback all changes    forum.hibernate.org

Newbie Joined: Thu Mar 27, 2008 11:45 am Posts: 10 Location: Russia Hi all. I'm not sure but may be it is bug. In my test application I try to make inheritance hierarchy usind "Table per subclass" method. So in test app I have different locations: streets, buildings, rooms. And I create next database structure for it: Code: DROP TABLE IF ...

71. Transaction.rollback doesn't work at all.    forum.hibernate.org

We are using Hibernate 2 with JBoss 4.2.0 and Struts 1.2.7. We are not using any EJB ! I have the persisted object 'dbCategory' of class AmpCategoryClass which has a List called "possibleValues" of AmpCategoryValue objects. (possibleValues has the 'all-delete-orphans' property set.) Now, whithin the transaction I am deleting several objects from the List 'possibleValues' but not all of them can ...

72. Rollback    forum.hibernate.org

Please help to Resolve following scenario. I have to insert 500 record in database using CMP beans and hibernate. Some exception happens when their is insertion for 201 record & 203 record. My Goal is that the system should not rollback the whole transaction but rather should save all the records except 201th and 203rd record.

73. rollback    forum.hibernate.org

Hi, I'm doing an API for a database using spring+hibernate. The arhitecture is: my testcase call a service, the service calls many methods from many DAO's, the DAO's use hibernate to get the data from DB. My goal is to keep the data of database unchanged after I'm runing the testcase. I would like to make rollback before to end the ...

74. Rollback Problem    forum.hibernate.org

Hi Friends, I am using hibernate 3.2.5. I have a parent table P. It has 2 children C1 & C2, my requirement is if there is a Exception while saving C1 or C2 the parent also should not be saved ie., the transation should rollback. But its not happening with the following code, the parent is getting saved & ofcourse the ...

75. Recovering from transaction rollback    forum.hibernate.org

Hi, I'd like to discuss how to recover state of objects (especially id) when transaction fails. I'll describe situation: I have simple one to many mappings (person-address) in which I want to add new address. I load person (from database) with e.g. two addresses, I add new address to set of addresses of person and then I'm trying to save person ...

76. hibernate.use_identifier_rollback can't work    forum.hibernate.org

Dear all I read the book "Java Persistence with Hibernate" In page 407, it says that if you enable the hibernat.use_identifier_rollback configuration option.Hibernate sets the database identifier property of the deleted item to null after deletion and flushing. I want to try this feature but it can't work. The code and hibernate configuration as below. Can someone help me to see ...

77. hibernate rollback issue on MyIsam    forum.hibernate.org

I am facing issue regarding hibernate rollback handling in MyIsam. I am using hibernate + Spring + MySQL 5.0. I have 2 entities with following relationship in my code: Stationery 1... * BookContent Stationery.hbm.xml has following: Code:

78. Incomplete rollback in hibernate    forum.hibernate.org

Need help with Hibernate? Read this first: We have DAO class which does multiple inser/update in single transaction.If one of the insert/update fails it doesn't rollback the earlier succesful insert. Suppose object 1 is inserted successfully and object 2 gets stale object exception the tx.rollback doesn't object 1 from database .Changes gets commited even though auto commit mode is false. Please ...

79. Solved: Rollback of transaction    forum.hibernate.org

Hi, I have problem with rollbacking the transaction. I create an application which create a record in table (entity) Application. Code: public void createApplication(EntityManager em, Application application) throws ApplicationServiceException { log.info("transaction status: " + em.getTransaction().isActive()); try { ...

80. Hibernate session and rollbacks    forum.hibernate.org

Hi, I have a class to manage the hibernate session and everything was going ok until i had an exception and the rollback didn't work. Let me explain my application: I have a table Person that is related with PhonesNumber table in a one-to-many relationship (using annotations) If I make an insertion of a person with phone numbers and for example ...