T5 : tapestry-hibernate : rollback when exception was thrown
I am using the tapestry-hibernate and 'hibernate.connection.autocommit' in hibernate.cfg.xml is set to false. After throwing a exception, transaction was committed. So I called HibernateSessionManager#abort(), but the transaction was still committed. Please tell me how to rollback the current transaction when a exception was thrown!!! @Inject Session session; public Object onSubmit(){ User user = new User(); user.setName( tapestry ); session.save( user ); throw new RuntimException() // for test } - Osamuo -- View this message in context: http://www.nabble.com/T5-%3A-tapestry-hibernate-%3A-rollback-when-exception-was-thrown-tp14990335p14990335.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 : tapestry-hibernate : rollback when exception was thrown
Try session.connection().commit(); o Please tell me how to rollback the current transaction when a exception was o thrown!!! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: tapestry-hibernate: rollback
have you set autocommit to off in hibernate config like this: property name=hibernate.connection.autocommitfalse/property osamuo wrote: Hi, I used the following code in order to rollback the current transaction. But its transaction was committed after the calling HibernateSessionManager.abort(). What's wrong? --- public class RegisterUser{ ... @Inject private Session session; @Inject private HibernateSessionManager sessionManager; public Object onSubmit(){ ... TmpUser tmpUser = new TmpUser(); ... session.save( tmpUser ); sessionManager.abort(); // force rollback return null; } } - Thanks, Osamuo Davor Hrg wrote: HibernateSessionManager On Jan 11, 2008 11:51 AM, Massimo Lusetti [EMAIL PROTECTED] wrote: On Jan 11, 2008 10:00 AM, osamuo [EMAIL PROTECTED] wrote: Hi, I have noticed that the tapestry-hibernate commits the current transaction even after an exception occurs. Is there any way to do rollback its transaction? Use the manager ? -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - best regards Sven -- View this message in context: http://www.nabble.com/T5%3A-tapestry-hibernate%3A-rollback-tp14752000p14774442.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: tapestry-hibernate: rollback
Hi, Yes, I have. I created 'hibernate.cfg.xml' like the following. -- hibernate-configuration session-factory property name=hibernate.dialectorg.hibernate.dialect.PostgreSQLDialect/property property name=hibernate.connection.urljdbc:postgresql://192.168.0.103/Test/property property name=hibernate.connection.usernametest/property property name=hibernate.connection.passwordtesttest/property property name=hibernate.connection.driver_classorg.postgresql.Driver/property property name=hibernate.cache.provider_classnet.sf.ehcache.hibernate.EhCacheProvider/property property name=hibernate.transaction.auto_close_sessionfalse/property property name=hibernate.jdbc.use_get_generated_keystrue/property property name=hibernate.cache.use_query_cachetrue/property property name=hibernate.bytecode.use_reflection_optimizertrue/property property name=hibernate.show_sqltrue/property property name=hibernate.format_sqltrue/property mapping class=TmpUser / /session-factory /hibernate-configuration -- Thanks, Osamuo Sven Homburg wrote: have you set autocommit to off in hibernate config like this: property name=hibernate.connection.autocommitfalse/property osamuo wrote: Hi, I used the following code in order to rollback the current transaction. But its transaction was committed after the calling HibernateSessionManager.abort(). What's wrong? --- public class RegisterUser{ ... @Inject private Session session; @Inject private HibernateSessionManager sessionManager; public Object onSubmit(){ ... TmpUser tmpUser = new TmpUser(); ... session.save( tmpUser ); sessionManager.abort(); // force rollback return null; } } - Thanks, Osamuo Davor Hrg wrote: HibernateSessionManager On Jan 11, 2008 11:51 AM, Massimo Lusetti [EMAIL PROTECTED] wrote: On Jan 11, 2008 10:00 AM, osamuo [EMAIL PROTECTED] wrote: Hi, I have noticed that the tapestry-hibernate commits the current transaction even after an exception occurs. Is there any way to do rollback its transaction? Use the manager ? -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-tapestry-hibernate%3A-rollback-tp14752000p14775087.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: tapestry-hibernate: rollback
i miss the autocommit property in your config 2008/1/12, osamuo [EMAIL PROTECTED]: Hi, Yes, I have. I created 'hibernate.cfg.xml' like the following. -- hibernate-configuration session-factory property name=hibernate.dialectorg.hibernate.dialect.PostgreSQLDialect /property property name=hibernate.connection.url jdbc:postgresql://192.168.0.103/Test/property property name=hibernate.connection.usernametest/property property name=hibernate.connection.passwordtesttest/property property name=hibernate.connection.driver_classorg.postgresql.Driver/property property name=hibernate.cache.provider_class net.sf.ehcache.hibernate.EhCacheProvider/property property name=hibernate.transaction.auto_close_sessionfalse/property property name=hibernate.jdbc.use_get_generated_keystrue/property property name=hibernate.cache.use_query_cachetrue/property property name=hibernate.bytecode.use_reflection_optimizer true/property property name=hibernate.show_sqltrue/property property name=hibernate.format_sqltrue/property mapping class=TmpUser / /session-factory /hibernate-configuration -- Thanks, Osamuo Sven Homburg wrote: have you set autocommit to off in hibernate config like this: property name=hibernate.connection.autocommitfalse/property osamuo wrote: Hi, I used the following code in order to rollback the current transaction. But its transaction was committed after the calling HibernateSessionManager.abort(). What's wrong? --- public class RegisterUser{ ... @Inject private Session session; @Inject private HibernateSessionManager sessionManager; public Object onSubmit(){ ... TmpUser tmpUser = new TmpUser(); ... session.save( tmpUser ); sessionManager.abort(); // force rollback return null; } } - Thanks, Osamuo Davor Hrg wrote: HibernateSessionManager On Jan 11, 2008 11:51 AM, Massimo Lusetti [EMAIL PROTECTED] wrote: On Jan 11, 2008 10:00 AM, osamuo [EMAIL PROTECTED] wrote: Hi, I have noticed that the tapestry-hibernate commits the current transaction even after an exception occurs. Is there any way to do rollback its transaction? Use the manager ? -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-tapestry-hibernate%3A-rollback-tp14752000p14775087.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- with regards Sven Homburg
Re: T5: tapestry-hibernate: rollback
Hi, I had mistaken. I had set 'hibernate.transaction.auto_close_session' instead of 'hibernate.connection.autocommit'. But I encountered the same condition again when I set 'hibernate.connection.autocommit' to false. -- hibernate-configuration session-factory property name=hibernate.dialectorg.hibernate.dialect.PostgreSQLDialect/property property name=hibernate.connection.urljdbc:postgresql://192.168.0.103/Test/property property name=hibernate.connection.usernametest/property property name=hibernate.connection.passwordtesttest/property property name=hibernate.connection.driver_classorg.postgresql.Driver/property property name=hibernate.cache.provider_classnet.sf.ehcache.hibernate.EhCacheProvider/property property name=hibernate.connection.autocommitfalse/property property name=hibernate.jdbc.use_get_generated_keystrue/property property name=hibernate.cache.use_query_cachetrue/property property name=hibernate.bytecode.use_reflection_optimizertrue/property property name=hibernate.show_sqltrue/property property name=hibernate.format_sqltrue/property mapping class=TmpUser / /session-factory /hibernate-configuration -- Thanks, Osamuo Sven Homburg wrote: i miss the autocommit property in your config 2008/1/12, osamuo [EMAIL PROTECTED]: Hi, Yes, I have. I created 'hibernate.cfg.xml' like the following. -- hibernate-configuration session-factory property name=hibernate.dialectorg.hibernate.dialect.PostgreSQLDialect /property property name=hibernate.connection.url jdbc:postgresql://192.168.0.103/Test/property property name=hibernate.connection.usernametest/property property name=hibernate.connection.passwordtesttest/property property name=hibernate.connection.driver_classorg.postgresql.Driver/property property name=hibernate.cache.provider_class net.sf.ehcache.hibernate.EhCacheProvider/property property name=hibernate.transaction.auto_close_sessionfalse/property property name=hibernate.jdbc.use_get_generated_keystrue/property property name=hibernate.cache.use_query_cachetrue/property property name=hibernate.bytecode.use_reflection_optimizer true/property property name=hibernate.show_sqltrue/property property name=hibernate.format_sqltrue/property mapping class=TmpUser / /session-factory /hibernate-configuration -- Thanks, Osamuo Sven Homburg wrote: have you set autocommit to off in hibernate config like this: property name=hibernate.connection.autocommitfalse/property osamuo wrote: Hi, I used the following code in order to rollback the current transaction. But its transaction was committed after the calling HibernateSessionManager.abort(). What's wrong? --- public class RegisterUser{ ... @Inject private Session session; @Inject private HibernateSessionManager sessionManager; public Object onSubmit(){ ... TmpUser tmpUser = new TmpUser(); ... session.save( tmpUser ); sessionManager.abort(); // force rollback return null; } } - Thanks, Osamuo Davor Hrg wrote: HibernateSessionManager On Jan 11, 2008 11:51 AM, Massimo Lusetti [EMAIL PROTECTED] wrote: On Jan 11, 2008 10:00 AM, osamuo [EMAIL PROTECTED] wrote: Hi, I have noticed that the tapestry-hibernate commits the current transaction even after an exception occurs. Is there any way to do rollback its transaction? Use the manager ? -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-tapestry-hibernate%3A-rollback-tp14752000p14775087.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- with regards Sven Homburg - best regards Sven -- View this message in context: http://www.nabble.com/T5%3A-tapestry-hibernate%3A-rollback-tp14752000p14775449.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: tapestry-hibernate: rollback
Hi, I have noticed that the tapestry-hibernate commits the current transaction even after an exception occurs. Is there any way to do rollback its transaction? Osamuo -- View this message in context: http://www.nabble.com/T5%3A-tapestry-hibernate%3A-rollback-tp14752000p14752000.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: tapestry-hibernate: rollback
On Jan 11, 2008 10:00 AM, osamuo [EMAIL PROTECTED] wrote: Hi, I have noticed that the tapestry-hibernate commits the current transaction even after an exception occurs. Is there any way to do rollback its transaction? Use the manager ? -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: tapestry-hibernate: rollback
HibernateSessionManager On Jan 11, 2008 11:51 AM, Massimo Lusetti [EMAIL PROTECTED] wrote: On Jan 11, 2008 10:00 AM, osamuo [EMAIL PROTECTED] wrote: Hi, I have noticed that the tapestry-hibernate commits the current transaction even after an exception occurs. Is there any way to do rollback its transaction? Use the manager ? -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: tapestry-hibernate: rollback
Hi, I used the following code in order to rollback the current transaction. But its transaction was committed after the calling HibernateSessionManager.abort(). What's wrong? --- public class RegisterUser{ ... @Inject private Session session; @Inject private HibernateSessionManager sessionManager; public Object onSubmit(){ ... TmpUser tmpUser = new TmpUser(); ... session.save( tmpUser ); sessionManager.abort(); // force rollback return null; } } - Thanks, Osamuo Davor Hrg wrote: HibernateSessionManager On Jan 11, 2008 11:51 AM, Massimo Lusetti [EMAIL PROTECTED] wrote: On Jan 11, 2008 10:00 AM, osamuo [EMAIL PROTECTED] wrote: Hi, I have noticed that the tapestry-hibernate commits the current transaction even after an exception occurs. Is there any way to do rollback its transaction? Use the manager ? -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-tapestry-hibernate%3A-rollback-tp14752000p14770190.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]