Re: Wicket + JPA lazy-loading

2012-03-19 Thread Martin Grigorov
Hi,

2012/3/18 Bálint Kriván bal...@krivan.hu:
 I don't want to serialize them but wicket does (I have a list of objects
 which I pass to a ListView).
 IIRC, If I use LDM I can make wicket to serialize only an ID and when it is
 readed back I can reach the backend to get the correct object for that ID.
 If I would switch to this probably it would be more query than now, because
 even the parent objects should be retrieved from the DB one-by-one.
 It would be enough for me if I could make wicket not to try to serialize
 these objects (these are retrieved in the constructor so I don't see the
 need to save them on the first place)

Wicket serializes the page and all inside it. If you keep refs to
these objects from your page then Java Serialization will try to
serialize them.
You can keep a set of all ids and load them (via LDM) with just one
SQL query at any time they are needed.


 On Sun, Mar 18, 2012 at 1:56 PM, James Carman 
 ja...@carmanconsulting.comwrote:

 Use a LoadableDetachableModel.  You shouldn't be serializing
 persistent objects (unless of course you're in the middle of editing
 them or something).

 On Sun, Mar 18, 2012 at 8:36 AM, Bálint Kriván bal...@krivan.hu wrote:
  Hey!
 
  It seems that when wicket is trying to serialize the persistent objects
  (probably to session) the lazy loading kicks in and it retrieves the
 whole
  graph.
  Not sure if wicket is using the default java serialization or a special
  one, but is there anybody else who is/were experiencing the same? By any
  chance would you have any suggestion how can I overcome this?
  It would be a great solution if an association is persisted when it's
  loaded, but if it isn't then do not lazy load it, just leave it null.
 
  Thanks!
 
  Regards,
  Bálint Kriván

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Üdv,
 Kriván Bálint



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket + JPA lazy-loading

2012-03-18 Thread Bálint Kriván
Hey!

It seems that when wicket is trying to serialize the persistent objects
(probably to session) the lazy loading kicks in and it retrieves the whole
graph.
Not sure if wicket is using the default java serialization or a special
one, but is there anybody else who is/were experiencing the same? By any
chance would you have any suggestion how can I overcome this?
It would be a great solution if an association is persisted when it's
loaded, but if it isn't then do not lazy load it, just leave it null.

Thanks!

Regards,
Bálint Kriván


Re: Wicket + JPA lazy-loading

2012-03-18 Thread James Carman
Use a LoadableDetachableModel.  You shouldn't be serializing
persistent objects (unless of course you're in the middle of editing
them or something).

On Sun, Mar 18, 2012 at 8:36 AM, Bálint Kriván bal...@krivan.hu wrote:
 Hey!

 It seems that when wicket is trying to serialize the persistent objects
 (probably to session) the lazy loading kicks in and it retrieves the whole
 graph.
 Not sure if wicket is using the default java serialization or a special
 one, but is there anybody else who is/were experiencing the same? By any
 chance would you have any suggestion how can I overcome this?
 It would be a great solution if an association is persisted when it's
 loaded, but if it isn't then do not lazy load it, just leave it null.

 Thanks!

 Regards,
 Bálint Kriván

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket + JPA lazy-loading

2012-03-18 Thread Bálint Kriván
I don't want to serialize them but wicket does (I have a list of objects
which I pass to a ListView).
IIRC, If I use LDM I can make wicket to serialize only an ID and when it is
readed back I can reach the backend to get the correct object for that ID.
If I would switch to this probably it would be more query than now, because
even the parent objects should be retrieved from the DB one-by-one.
It would be enough for me if I could make wicket not to try to serialize
these objects (these are retrieved in the constructor so I don't see the
need to save them on the first place)

On Sun, Mar 18, 2012 at 1:56 PM, James Carman ja...@carmanconsulting.comwrote:

 Use a LoadableDetachableModel.  You shouldn't be serializing
 persistent objects (unless of course you're in the middle of editing
 them or something).

 On Sun, Mar 18, 2012 at 8:36 AM, Bálint Kriván bal...@krivan.hu wrote:
  Hey!
 
  It seems that when wicket is trying to serialize the persistent objects
  (probably to session) the lazy loading kicks in and it retrieves the
 whole
  graph.
  Not sure if wicket is using the default java serialization or a special
  one, but is there anybody else who is/were experiencing the same? By any
  chance would you have any suggestion how can I overcome this?
  It would be a great solution if an association is persisted when it's
  loaded, but if it isn't then do not lazy load it, just leave it null.
 
  Thanks!
 
  Regards,
  Bálint Kriván

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Üdv,
Kriván Bálint


Re: Wicket + JPA lazy-loading

2012-03-18 Thread James Carman
Try with an ldm I'd say.
On Mar 18, 2012 9:04 AM, Bálint Kriván bal...@krivan.hu wrote:

 I don't want to serialize them but wicket does (I have a list of objects
 which I pass to a ListView).
 IIRC, If I use LDM I can make wicket to serialize only an ID and when it is
 readed back I can reach the backend to get the correct object for that ID.
 If I would switch to this probably it would be more query than now, because
 even the parent objects should be retrieved from the DB one-by-one.
 It would be enough for me if I could make wicket not to try to serialize
 these objects (these are retrieved in the constructor so I don't see the
 need to save them on the first place)

 On Sun, Mar 18, 2012 at 1:56 PM, James Carman ja...@carmanconsulting.com
 wrote:

  Use a LoadableDetachableModel.  You shouldn't be serializing
  persistent objects (unless of course you're in the middle of editing
  them or something).
 
  On Sun, Mar 18, 2012 at 8:36 AM, Bálint Kriván bal...@krivan.hu wrote:
   Hey!
  
   It seems that when wicket is trying to serialize the persistent objects
   (probably to session) the lazy loading kicks in and it retrieves the
  whole
   graph.
   Not sure if wicket is using the default java serialization or a special
   one, but is there anybody else who is/were experiencing the same? By
 any
   chance would you have any suggestion how can I overcome this?
   It would be a great solution if an association is persisted when it's
   loaded, but if it isn't then do not lazy load it, just leave it null.
  
   Thanks!
  
   Regards,
   Bálint Kriván
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 


 --
 Üdv,
 Kriván Bálint