Re: ajax request and hibernate lazy loading

2008-11-08 Thread Martijn Dashorst
It's a matter of using the right Model: in this case you should use
LoadableDetachableModels—for your list and for the selected item. The
models page on the wiki has ample information, as does this excellent
article by Igor:
http://wicketinaction.com/2008/09/building-a-smart-entitymodel. IIRC
the phonebook also shows you how to achieve this. Assuming you have
The Book, you might want to check out chapter 4 and read up on
detachable models.

Martijn

On Fri, Nov 7, 2008 at 2:36 PM, miro [EMAIL PROTECTED] wrote:

 You are right this is  not related to ajax  and more of hibernate .
 here is my object hirearchy

  EaBatchInfo   has many EaBatchAuditInfo


 In the page constructor I load List of EaBatchInfo and render my page
 .By default I   pull the first index from list to display  EaBatchAuditInfo
 from EaBatchInfo.
 now  when user wants to  see second   EaBatchInfo.EaBatchAuditInfo  he
 clicks on  second EaBatchInfo  in  onclick method I try to get
 EaBatchAuditInfo  for second EaBatchInfo  and here i get lazy loading
 exception becasue   the session was closed when rendering my page first time
 and the new session created dosent have  list of  EaBatchInfo so one
 solution is to have OpenSeissionView  pattern  in my page construction and
 desctruction ,  are there any example of open view session pattern for a
 wicket page lifetime ?


 Martijn Dashorst wrote:

 I would actually keep using OSIV.

 To answer the question: probably you are using models wrong. If OSIV
 works for your normal requests, it works for Ajax requests. There is
 nothing different between these requests.

 Martijn

 On Fri, Nov 7, 2008 at 1:33 PM, Bruno Borges [EMAIL PROTECTED]
 wrote:
 With Ajax request I would probably avoid that pattern.
 That could lead to serious problems.

 How about having a different method to load the object with the required
 data for that specific ajax request?

 cheers,
 Bruno Borges
 blog.brunoborges.com.br
 +55 21 76727099

 The glory of great men should always be
 measured by the means they have used to
 acquire it.
 - Francois de La Rochefoucauld


 On Fri, Nov 7, 2008 at 1:27 PM, miro [EMAIL PROTECTED] wrote:


 I am using hibernate and all my collections are lazy  , they get loaded
 only
 when called . I am also using ajax to get collection property on click ,
 but
 i am getting Lazy loading exception  for ajax  request where I load the
 collection ,  I am using
 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
 ,Please
 help mehow to use OpenSessionInViewFilterwith ajax calls ?
 --
 View this message in context:
 http://www.nabble.com/ajax-request-and-hibernate-lazy-loading-tp20387124p20387124.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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






 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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




 --
 View this message in context: 
 http://www.nabble.com/ajax-request-and-hibernate-lazy-loading-tp20387124p20388432.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



Re: ajax request and hibernate lazy loading

2008-11-07 Thread Bruno Borges
With Ajax request I would probably avoid that pattern.
That could lead to serious problems.

How about having a different method to load the object with the required
data for that specific ajax request?

cheers,
Bruno Borges
blog.brunoborges.com.br
+55 21 76727099

The glory of great men should always be
measured by the means they have used to
acquire it.
- Francois de La Rochefoucauld


On Fri, Nov 7, 2008 at 1:27 PM, miro [EMAIL PROTECTED] wrote:


 I am using hibernate and all my collections are lazy  , they get loaded
 only
 when called . I am also using ajax to get collection property on click ,
 but
 i am getting Lazy loading exception  for ajax  request where I load the
 collection ,  I am using
 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter  ,Please
 help mehow to use OpenSessionInViewFilterwith ajax calls ?
 --
 View this message in context:
 http://www.nabble.com/ajax-request-and-hibernate-lazy-loading-tp20387124p20387124.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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




ajax request and hibernate lazy loading

2008-11-07 Thread miro

I am using hibernate and all my collections are lazy  , they get loaded only
when called . I am also using ajax to get collection property on click , but
i am getting Lazy loading exception  for ajax  request where I load the
collection ,  I am using
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter  ,Please
help mehow to use OpenSessionInViewFilterwith ajax calls ?
-- 
View this message in context: 
http://www.nabble.com/ajax-request-and-hibernate-lazy-loading-tp20387124p20387124.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: ajax request and hibernate lazy loading

2008-11-07 Thread Martijn Dashorst
I would actually keep using OSIV.

To answer the question: probably you are using models wrong. If OSIV
works for your normal requests, it works for Ajax requests. There is
nothing different between these requests.

Martijn

On Fri, Nov 7, 2008 at 1:33 PM, Bruno Borges [EMAIL PROTECTED] wrote:
 With Ajax request I would probably avoid that pattern.
 That could lead to serious problems.

 How about having a different method to load the object with the required
 data for that specific ajax request?

 cheers,
 Bruno Borges
 blog.brunoborges.com.br
 +55 21 76727099

 The glory of great men should always be
 measured by the means they have used to
 acquire it.
 - Francois de La Rochefoucauld


 On Fri, Nov 7, 2008 at 1:27 PM, miro [EMAIL PROTECTED] wrote:


 I am using hibernate and all my collections are lazy  , they get loaded
 only
 when called . I am also using ajax to get collection property on click ,
 but
 i am getting Lazy loading exception  for ajax  request where I load the
 collection ,  I am using
 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter  ,Please
 help mehow to use OpenSessionInViewFilterwith ajax calls ?
 --
 View this message in context:
 http://www.nabble.com/ajax-request-and-hibernate-lazy-loading-tp20387124p20387124.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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






-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



Re: ajax request and hibernate lazy loading

2008-11-07 Thread miro

You are right this is  not related to ajax  and more of hibernate .
here is my object hirearchy

 EaBatchInfo   has many EaBatchAuditInfo 


In the page constructor I load List of EaBatchInfo and render my page 
.By default I   pull the first index from list to display  EaBatchAuditInfo  
from EaBatchInfo.
now  when user wants to  see second   EaBatchInfo.EaBatchAuditInfo  he
clicks on  second EaBatchInfo  in  onclick method I try to get
EaBatchAuditInfo  for second EaBatchInfo  and here i get lazy loading  
exception becasue   the session was closed when rendering my page first time 
and the new session created dosent have  list of  EaBatchInfo so one
solution is to have OpenSeissionView  pattern  in my page construction and
desctruction ,  are there any example of open view session pattern for a
wicket page lifetime ?
 

Martijn Dashorst wrote:
 
 I would actually keep using OSIV.
 
 To answer the question: probably you are using models wrong. If OSIV
 works for your normal requests, it works for Ajax requests. There is
 nothing different between these requests.
 
 Martijn
 
 On Fri, Nov 7, 2008 at 1:33 PM, Bruno Borges [EMAIL PROTECTED]
 wrote:
 With Ajax request I would probably avoid that pattern.
 That could lead to serious problems.

 How about having a different method to load the object with the required
 data for that specific ajax request?

 cheers,
 Bruno Borges
 blog.brunoborges.com.br
 +55 21 76727099

 The glory of great men should always be
 measured by the means they have used to
 acquire it.
 - Francois de La Rochefoucauld


 On Fri, Nov 7, 2008 at 1:27 PM, miro [EMAIL PROTECTED] wrote:


 I am using hibernate and all my collections are lazy  , they get loaded
 only
 when called . I am also using ajax to get collection property on click ,
 but
 i am getting Lazy loading exception  for ajax  request where I load the
 collection ,  I am using
 org.springframework.orm.hibernate3.support.OpenSessionInViewFilter 
 ,Please
 help mehow to use OpenSessionInViewFilterwith ajax calls ?
 --
 View this message in context:
 http://www.nabble.com/ajax-request-and-hibernate-lazy-loading-tp20387124p20387124.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



 
 
 
 -- 
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/ajax-request-and-hibernate-lazy-loading-tp20387124p20388432.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: ajax request and hibernate lazy loading

2008-11-07 Thread Nino Saturnino Martinez Vazquez Wael

Yep that was also what I were thinking.

Martijn Dashorst wrote:

I would actually keep using OSIV.

To answer the question: probably you are using models wrong. If OSIV
works for your normal requests, it works for Ajax requests. There is
nothing different between these requests.

Martijn

On Fri, Nov 7, 2008 at 1:33 PM, Bruno Borges [EMAIL PROTECTED] wrote:
  

With Ajax request I would probably avoid that pattern.
That could lead to serious problems.

How about having a different method to load the object with the required
data for that specific ajax request?

cheers,
Bruno Borges
blog.brunoborges.com.br
+55 21 76727099

The glory of great men should always be
measured by the means they have used to
acquire it.
- Francois de La Rochefoucauld


On Fri, Nov 7, 2008 at 1:27 PM, miro [EMAIL PROTECTED] wrote:



I am using hibernate and all my collections are lazy  , they get loaded
only
when called . I am also using ajax to get collection property on click ,
but
i am getting Lazy loading exception  for ajax  request where I load the
collection ,  I am using
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter  ,Please
help mehow to use OpenSessionInViewFilterwith ajax calls ?
--
View this message in context:
http://www.nabble.com/ajax-request-and-hibernate-lazy-loading-tp20387124p20387124.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


  




  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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