Hibernate example broken with 5.0.15

2008-10-06 Thread János Jarecsni
Hi All,

I tested the simple Hibernate example (
http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryHibernate) quite a
while ago with T5.0.11. Now I restarted studying Tapestry, tried the
application now with 5.0.15. It seems that the application can read from the
table, but cannot insert into it. I found no exceptions. I tried with the
5.0.11 version, it still works. I replaced the Tapestry version with T5.0.15
and it breaks. Can it be that I have to upgrade Hibernate as well?

Thx a lot
Janos


Re: Hibernate example broken with 5.0.15

2008-10-06 Thread János Jarecsni
Hi

thanks for the info, with @CommitAfter it works :) I just included the
close() to see if something happens :) That way I got an exception at least
:)

thanks again!
Cheers,
Janos

2008/10/6 Davor Hrg [EMAIL PROTECTED]

 you should post the errors you get,
 and, also methods that save data should have
 @CommitAfter annotation now.

 ...and you need not close the session
 it will get closed automatically,
 and that is actualy the reason the exception occurs

 Davor Hrg

 On Mon, Oct 6, 2008 at 11:23 AM, János Jarecsni [EMAIL PROTECTED]
 wrote:

  Hi again,
 
  I made some investigations into the matter. Here's my modified onAction
  method from the page class HbAction:
 
 public void onAction() {
 Hello h = new Hello();
 h.setMessage(Hello World);
 _session.save(h);
 List list = _session.createCriteria(Hello.class).list();
 System.out.println(Hellos stored:  + list.size());
 _session.close();
 }
 
  So I included a close(). This reveled, why the newly inserted Hello
  entities
  are not persisted. I get the following exception now:
 
  11:20:15,889 [ WARN] PerthreadManager - Error invoking listener
 
 [EMAIL PROTECTED]
  :
  Session is closed
  org.hibernate.SessionException: Session is closed
 at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:139)
 at
 
 
 org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:217)
 at
 
 
 org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:196)
 at
 
 
 org.apache.tapestry5.internal.hibernate.HibernateSessionManagerImpl.threadDidCleanup(HibernateSessionManagerImpl.java:65)
 at
 
 
 org.apache.tapestry5.ioc.internal.services.PerthreadManagerImpl.cleanup(PerthreadManagerImpl.java:86)
 at
 
 
 org.apache.tapestry5.ioc.internal.RegistryImpl.cleanupThread(RegistryImpl.java:327)
 at
 
 
 org.apache.tapestry5.ioc.internal.RegistryWrapper.cleanupThread(RegistryWrapper.java:36)
 at
  org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:185)
 
  So this means, that for some reason a rollback is issued after the method
  finished. Why? Any hints are welcome :)
 
  Cheers
  Janos
 
 
  2008/10/6 János Jarecsni [EMAIL PROTECTED]
 
   Hi All,
  
   I tested the simple Hibernate example (
   http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryHibernate)
  quite
   a while ago with T5.0.11. Now I restarted studying Tapestry, tried the
   application now with 5.0.15. It seems that the application can read
 from
   the table, but cannot insert into it. I found no exceptions. I tried
 with
   the 5.0.11 version, it still works. I replaced the Tapestry version
 with
   T5.0.15 and it breaks. Can it be that I have to upgrade Hibernate as
  well?
  
   Thx a lot
   Janos
  
 



Re: Hibernate example broken with 5.0.15

2008-10-06 Thread János Jarecsni
Hi again,

I made some investigations into the matter. Here's my modified onAction
method from the page class HbAction:

public void onAction() {
Hello h = new Hello();
h.setMessage(Hello World);
_session.save(h);
List list = _session.createCriteria(Hello.class).list();
System.out.println(Hellos stored:  + list.size());
_session.close();
}

So I included a close(). This reveled, why the newly inserted Hello entities
are not persisted. I get the following exception now:

11:20:15,889 [ WARN] PerthreadManager - Error invoking listener
[EMAIL PROTECTED]:
Session is closed
org.hibernate.SessionException: Session is closed
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:139)
at
org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:217)
at
org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:196)
at
org.apache.tapestry5.internal.hibernate.HibernateSessionManagerImpl.threadDidCleanup(HibernateSessionManagerImpl.java:65)
at
org.apache.tapestry5.ioc.internal.services.PerthreadManagerImpl.cleanup(PerthreadManagerImpl.java:86)
at
org.apache.tapestry5.ioc.internal.RegistryImpl.cleanupThread(RegistryImpl.java:327)
at
org.apache.tapestry5.ioc.internal.RegistryWrapper.cleanupThread(RegistryWrapper.java:36)
at
org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:185)

So this means, that for some reason a rollback is issued after the method
finished. Why? Any hints are welcome :)

Cheers
Janos


2008/10/6 János Jarecsni [EMAIL PROTECTED]

 Hi All,

 I tested the simple Hibernate example (
 http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryHibernate) quite
 a while ago with T5.0.11. Now I restarted studying Tapestry, tried the
 application now with 5.0.15. It seems that the application can read from
 the table, but cannot insert into it. I found no exceptions. I tried with
 the 5.0.11 version, it still works. I replaced the Tapestry version with
 T5.0.15 and it breaks. Can it be that I have to upgrade Hibernate as well?

 Thx a lot
 Janos



Re: Hibernate example broken with 5.0.15

2008-10-06 Thread Davor Hrg
you should post the errors you get,
and, also methods that save data should have
@CommitAfter annotation now.

...and you need not close the session
it will get closed automatically,
and that is actualy the reason the exception occurs

Davor Hrg

On Mon, Oct 6, 2008 at 11:23 AM, János Jarecsni [EMAIL PROTECTED]wrote:

 Hi again,

 I made some investigations into the matter. Here's my modified onAction
 method from the page class HbAction:

public void onAction() {
Hello h = new Hello();
h.setMessage(Hello World);
_session.save(h);
List list = _session.createCriteria(Hello.class).list();
System.out.println(Hellos stored:  + list.size());
_session.close();
}

 So I included a close(). This reveled, why the newly inserted Hello
 entities
 are not persisted. I get the following exception now:

 11:20:15,889 [ WARN] PerthreadManager - Error invoking listener
 [EMAIL PROTECTED]
 :
 Session is closed
 org.hibernate.SessionException: Session is closed
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:139)
at

 org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:217)
at

 org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:196)
at

 org.apache.tapestry5.internal.hibernate.HibernateSessionManagerImpl.threadDidCleanup(HibernateSessionManagerImpl.java:65)
at

 org.apache.tapestry5.ioc.internal.services.PerthreadManagerImpl.cleanup(PerthreadManagerImpl.java:86)
at

 org.apache.tapestry5.ioc.internal.RegistryImpl.cleanupThread(RegistryImpl.java:327)
at

 org.apache.tapestry5.ioc.internal.RegistryWrapper.cleanupThread(RegistryWrapper.java:36)
at
 org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:185)

 So this means, that for some reason a rollback is issued after the method
 finished. Why? Any hints are welcome :)

 Cheers
 Janos


 2008/10/6 János Jarecsni [EMAIL PROTECTED]

  Hi All,
 
  I tested the simple Hibernate example (
  http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryHibernate)
 quite
  a while ago with T5.0.11. Now I restarted studying Tapestry, tried the
  application now with 5.0.15. It seems that the application can read from
  the table, but cannot insert into it. I found no exceptions. I tried with
  the 5.0.11 version, it still works. I replaced the Tapestry version with
  T5.0.15 and it breaks. Can it be that I have to upgrade Hibernate as
 well?
 
  Thx a lot
  Janos