you should not persist hibernate entities between requests,

a call was loaded from db, and put into list,
after that it was stored in mem and session closed
on next request you use that ol object and
when a lazy loaded property "usr" was being initialized by
hibernate, it failed.

the doSearch shold be called inside a render request, not inside
acton req and persisted.

you should persist a flag
@Persist private boolean isSearch;

   String onSuccess() {
       isSearch=true;
       return null;
   }

   public List<Call> getCalls() {
       if(isSearch) return session.createQuery("from Call").list();
       return new ArrayList<Call>();
   }


if you use grid,
I have something for it:
http://wiki.apache.org/tapestry/Tapestry5HibernateGridDatasource2

Davor Hrg


On Fri, Feb 15, 2008 at 8:47 AM, Angelo Chen <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>  I have several pages working well in T5.0.9 but got following error in
>  T5.0.10:
>
>  An unexpected application exception has occurred.
>  Render queue error in Expansion[PropBinding[expansion
>  TestPage1(call.usr.name)]]: could not initialize proxy - the owning Session
>  was closed
>
>  here is a simplified version of the code, the part of problem is :
>  ${call.usr.name}, when this is omitted, everything works, hibernate seems
>  correct, but why it works in T5.0.9, any way to make it work in 5.0.10 too?
>
>  page:
>
>  public class TestPage1 {
>
>     @Persist("flash")
>     private List<Call> calls;
>
>     public List<Call> getCalls() {
>         return calls;
>     }
>     private Call call;
>     public Call getCall() {
>         return call;
>     }
>     public void setCall(Call call) {
>         this.call = call;
>     }
>     @Inject
>     private Session session;
>     private void doSearch() {
>         calls = session.createQuery("from Call").list();
>     }
>     String onSuccess() {
>         doSearch();
>         return null;
>     }
>  }
>
>  template:
>
>  <t:form >
>    <input type="submit"  value="submit" /><br />
>  </t:form>
>
>  <table t:type="grid" source="calls" row="call" >
>         <t:parameter name="idCell">
>        ${call.id} ${call.usr.name}
>     </t:parameter>
>  </table>
>  --
>  View this message in context: 
> http://www.nabble.com/T5%3A-T5.0.10-and-Hibernate-tp15496042p15496042.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]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to