Re: Wicket, Hibernate and Models

2008-03-13 Thread Peter Ertl

whew - glad to hear :-)

[having probably hundreds of anonymous models in his projects]

Am 13.03.2008 um 17:46 schrieb Igor Vaynberg:


actually not in 1.3. our serialization is smart enough to take this
into account if i remember correctly.

-igor


On Thu, Mar 13, 2008 at 8:47 AM, Leszek Gawron  
<[EMAIL PROTECTED]> wrote:


Maurice Marrink wrote:

I believe refreshingview has better support for reusing items but in
our apps we hardly ever use refreshingview. both are suitable for  
use

with hibernate.

Maurice

On Thu, Mar 13, 2008 at 4:35 PM, carloc <[EMAIL PROTECTED]>  
wrote:

What should I use when I am accessing hibernate?
Should I use a ListView or should I use a refreshing view?\
In the api it says to use refreshingview instead of using  
listview when

using database collections
what is better to use?



carloc wrote:


Hi everyone,

I have been reading wicket in action recently and I have seen  
pitfalls of

hibernate section.
I was wondering about the stuff about hibernate and memory leaks  
due to
hibernate proxy objects maintaining a reference to the session  
with

them


Am I doing this wrong then?
@SpringBean
private UserService userService;

add(new ListView("user", userService.findUsers() {
})

is this wrong? I'm using it directly meaning it will be stored  
in the page

store right?

should i be doing this instead?

LoadableDetachableModel model = new LoadableDetachablemodel() {
   Object load() {
  return usrService.findUsers()
  }

}


please mind that you shouldn't create anonymous model classes as they
keep the reference to the page/panel and you will fall into other  
memory

issues.


--
Leszek Gawron http://www.mobilebox.pl/ 
krs.html

CTO at MobileBox Ltd.




-
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]



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



Re: Wicket, Hibernate and Models

2008-03-13 Thread Igor Vaynberg
actually not in 1.3. our serialization is smart enough to take this
into account if i remember correctly.

-igor


On Thu, Mar 13, 2008 at 8:47 AM, Leszek Gawron <[EMAIL PROTECTED]> wrote:
>
> Maurice Marrink wrote:
>  > I believe refreshingview has better support for reusing items but in
>  > our apps we hardly ever use refreshingview. both are suitable for use
>  > with hibernate.
>  >
>  > Maurice
>  >
>  > On Thu, Mar 13, 2008 at 4:35 PM, carloc <[EMAIL PROTECTED]> wrote:
>  >>  What should I use when I am accessing hibernate?
>  >>  Should I use a ListView or should I use a refreshing view?\
>  >>  In the api it says to use refreshingview instead of using listview when
>  >>  using database collections
>  >>  what is better to use?
>  >>
>  >>
>  >>
>  >>  carloc wrote:
>  >>  >
>  >>  > Hi everyone,
>  >>  >
>  >>  > I have been reading wicket in action recently and I have seen pitfalls 
> of
>  >>  > hibernate section.
>  >>  > I was wondering about the stuff about hibernate and memory leaks due to
>  >>  > hibernate proxy objects maintaining a reference to the session with
>  >>  > them
>  >>  >
>  >>  >
>  >>  > Am I doing this wrong then?
>  >>  > @SpringBean
>  >>  > private UserService userService;
>  >>  >
>  >>  > add(new ListView("user", userService.findUsers() {
>  >>  > })
>  >>  >
>  >>  > is this wrong? I'm using it directly meaning it will be stored in the 
> page
>  >>  > store right?
>  >>  >
>  >>  > should i be doing this instead?
>  >>  >
>  >>  > LoadableDetachableModel model = new LoadableDetachablemodel() {
>  >>  > Object load() {
>  >>  >return usrService.findUsers()
>  >>  >}
>  >>  >
>  >>  > }
>
>  please mind that you shouldn't create anonymous model classes as they
>  keep the reference to the page/panel and you will fall into other memory
>  issues.
>
>
>  --
>  Leszek Gawron http://www.mobilebox.pl/krs.html
>  CTO at MobileBox Ltd.
>
>
>
>
>  -
>  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: Wicket, Hibernate and Models

2008-03-13 Thread Peter Ertl
> please mind that you shouldn't create anonymous model classes as  
they keep the reference to the page/panel and you will fall into other  
memory issues.


could you elaborate on that?


Am 13.03.2008 um 16:47 schrieb Leszek Gawron:


Maurice Marrink wrote:

I believe refreshingview has better support for reusing items but in
our apps we hardly ever use refreshingview. both are suitable for use
with hibernate.
Maurice
On Thu, Mar 13, 2008 at 4:35 PM, carloc <[EMAIL PROTECTED]>  
wrote:

What should I use when I am accessing hibernate?
Should I use a ListView or should I use a refreshing view?\
In the api it says to use refreshingview instead of using listview  
when

using database collections
what is better to use?



carloc wrote:
>
> Hi everyone,
>
> I have been reading wicket in action recently and I have seen  
pitfalls of

> hibernate section.
> I was wondering about the stuff about hibernate and memory leaks  
due to
> hibernate proxy objects maintaining a reference to the session  
with

> them
>
>
> Am I doing this wrong then?
> @SpringBean
> private UserService userService;
>
> add(new ListView("user", userService.findUsers() {
> })
>
> is this wrong? I'm using it directly meaning it will be stored  
in the page

> store right?
>
> should i be doing this instead?
>
> LoadableDetachableModel model = new LoadableDetachablemodel() {
> Object load() {
>return usrService.findUsers()
>}
>
> }


please mind that you shouldn't create anonymous model classes as  
they keep the reference to the page/panel and you will fall into  
other memory issues.



--
Leszek Gawron http://www.mobilebox.pl/krs.html
CTO at MobileBox Ltd.


-
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: Wicket, Hibernate and Models

2008-03-13 Thread Leszek Gawron

Maurice Marrink wrote:

I believe refreshingview has better support for reusing items but in
our apps we hardly ever use refreshingview. both are suitable for use
with hibernate.

Maurice

On Thu, Mar 13, 2008 at 4:35 PM, carloc <[EMAIL PROTECTED]> wrote:

 What should I use when I am accessing hibernate?
 Should I use a ListView or should I use a refreshing view?\
 In the api it says to use refreshingview instead of using listview when
 using database collections
 what is better to use?



 carloc wrote:
 >
 > Hi everyone,
 >
 > I have been reading wicket in action recently and I have seen pitfalls of
 > hibernate section.
 > I was wondering about the stuff about hibernate and memory leaks due to
 > hibernate proxy objects maintaining a reference to the session with
 > them
 >
 >
 > Am I doing this wrong then?
 > @SpringBean
 > private UserService userService;
 >
 > add(new ListView("user", userService.findUsers() {
 > })
 >
 > is this wrong? I'm using it directly meaning it will be stored in the page
 > store right?
 >
 > should i be doing this instead?
 >
 > LoadableDetachableModel model = new LoadableDetachablemodel() {
 > Object load() {
 >return usrService.findUsers()
 >}
 >
 > }


please mind that you shouldn't create anonymous model classes as they 
keep the reference to the page/panel and you will fall into other memory 
issues.



--
Leszek Gawron http://www.mobilebox.pl/krs.html
CTO at MobileBox Ltd.


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



Re: Wicket, Hibernate and Models

2008-03-13 Thread Igor Vaynberg
heh. make sure all your listviews override getlistitemmodel()
otherwise you can run into all kinds of problems if you use listview
to select items not just display them...

-igor


On Thu, Mar 13, 2008 at 8:38 AM, Maurice Marrink <[EMAIL PROTECTED]> wrote:
> I believe refreshingview has better support for reusing items but in
>  our apps we hardly ever use refreshingview. both are suitable for use
>  with hibernate.
>
>  Maurice
>
>
>
>  On Thu, Mar 13, 2008 at 4:35 PM, carloc <[EMAIL PROTECTED]> wrote:
>  >
>  >  What should I use when I am accessing hibernate?
>  >  Should I use a ListView or should I use a refreshing view?\
>  >  In the api it says to use refreshingview instead of using listview when
>  >  using database collections
>  >  what is better to use?
>  >
>  >
>  >
>  >  carloc wrote:
>  >  >
>  >  > Hi everyone,
>  >  >
>  >  > I have been reading wicket in action recently and I have seen pitfalls 
> of
>  >  > hibernate section.
>  >  > I was wondering about the stuff about hibernate and memory leaks due to
>  >  > hibernate proxy objects maintaining a reference to the session with
>  >  > them
>  >  >
>  >  >
>  >  > Am I doing this wrong then?
>  >  > @SpringBean
>  >  > private UserService userService;
>  >  >
>  >  > add(new ListView("user", userService.findUsers() {
>  >  > })
>  >  >
>  >  > is this wrong? I'm using it directly meaning it will be stored in the 
> page
>  >  > store right?
>  >  >
>  >  > should i be doing this instead?
>  >  >
>  >  > LoadableDetachableModel model = new LoadableDetachablemodel() {
>  >  > Object load() {
>  >  >return usrService.findUsers()
>  >  >}
>  >  >
>  >  > }
>  >  > }
>  >  >
>  >  > add(new ListView("listView", model)) {
>  >  > }
>  >  >
>  >  > this is to avoid storing the users in the session...
>  >  > will doing the first one actually result in a memory leak?
>  >  >
>  >  > thanks
>  >  >
>  >
>  >  --
>  >  View this message in context: 
> http://www.nabble.com/Wicket%2C-Hibernate-and-Models-tp16025532p16028751.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]
>  >
>  >
>
>  -
>  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: Wicket, Hibernate and Models

2008-03-13 Thread Maurice Marrink
I believe refreshingview has better support for reusing items but in
our apps we hardly ever use refreshingview. both are suitable for use
with hibernate.

Maurice

On Thu, Mar 13, 2008 at 4:35 PM, carloc <[EMAIL PROTECTED]> wrote:
>
>  What should I use when I am accessing hibernate?
>  Should I use a ListView or should I use a refreshing view?\
>  In the api it says to use refreshingview instead of using listview when
>  using database collections
>  what is better to use?
>
>
>
>  carloc wrote:
>  >
>  > Hi everyone,
>  >
>  > I have been reading wicket in action recently and I have seen pitfalls of
>  > hibernate section.
>  > I was wondering about the stuff about hibernate and memory leaks due to
>  > hibernate proxy objects maintaining a reference to the session with
>  > them
>  >
>  >
>  > Am I doing this wrong then?
>  > @SpringBean
>  > private UserService userService;
>  >
>  > add(new ListView("user", userService.findUsers() {
>  > })
>  >
>  > is this wrong? I'm using it directly meaning it will be stored in the page
>  > store right?
>  >
>  > should i be doing this instead?
>  >
>  > LoadableDetachableModel model = new LoadableDetachablemodel() {
>  > Object load() {
>  >return usrService.findUsers()
>  >}
>  >
>  > }
>  > }
>  >
>  > add(new ListView("listView", model)) {
>  > }
>  >
>  > this is to avoid storing the users in the session...
>  > will doing the first one actually result in a memory leak?
>  >
>  > thanks
>  >
>
>  --
>  View this message in context: 
> http://www.nabble.com/Wicket%2C-Hibernate-and-Models-tp16025532p16028751.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]
>
>

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



Re: Wicket, Hibernate and Models

2008-03-13 Thread carloc

What should I use when I am accessing hibernate?
Should I use a ListView or should I use a refreshing view?\
In the api it says to use refreshingview instead of using listview when
using database collections
what is better to use?


carloc wrote:
> 
> Hi everyone,
> 
> I have been reading wicket in action recently and I have seen pitfalls of
> hibernate section.
> I was wondering about the stuff about hibernate and memory leaks due to
> hibernate proxy objects maintaining a reference to the session with
> them
> 
> 
> Am I doing this wrong then?
> @SpringBean
> private UserService userService;
> 
> add(new ListView("user", userService.findUsers() {
> })
> 
> is this wrong? I'm using it directly meaning it will be stored in the page
> store right?
> 
> should i be doing this instead?
> 
> LoadableDetachableModel model = new LoadableDetachablemodel() {
> Object load() {
>return usrService.findUsers()
>}
> 
> }
> }
> 
> add(new ListView("listView", model)) {
> }
> 
> this is to avoid storing the users in the session...
> will doing the first one actually result in a memory leak?
> 
> thanks
> 

-- 
View this message in context: 
http://www.nabble.com/Wicket%2C-Hibernate-and-Models-tp16025532p16028751.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: Wicket, Hibernate and Models

2008-03-13 Thread Mathias P.W Nilsson

Yes I think you are right. By using the LoadableDetachableModel you prevent
the List to be put in the session. 
-- 
View this message in context: 
http://www.nabble.com/Wicket%2C-Hibernate-and-Models-tp16025532p16026919.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: Wicket, Hibernate and Models

2008-03-13 Thread Maurice Marrink
I think the memleak will not occur that easily because i believe
hibernate removes the session from each proxy / persistent bag after
it is closed. But you really should use the LDM (or another sort of
lazy loading model) because it will prevent a lot of
lazyinitexceptions and other hibernate exceptions that might occur
because the session for those objects is no longer available.

Maurice

On Thu, Mar 13, 2008 at 3:04 PM, carloc <[EMAIL PROTECTED]> wrote:
>
>  Hi everyone,
>
>  I have been reading wicket in action recently and I have seen pitfalls of
>  hibernate section.
>  I was wondering about the stuff about hibernate and memory leaks due to
>  hibernate proxy objects maintaining a reference to the session with them
>
>
>  Am I doing this wrong then?
>  @SpringBean
>  private UserService userService;
>
>  add(new ListView("user", userService.findUsers() {
>  })
>
>  is this wrong? I'm using it directly meaning it will be stored in the page
>  store right?
>
>  should i be doing this instead?
>
>  LoadableDetachableModel model = new LoadableDetachablemodel() {
> Object load() {
>return usrService.findUsers()
>}
>
>  }
>  }
>
>  add(new ListView("listView", model)) {
>  }
>
>  this is to avoid storing the users in the session...
>  will doing the first one actually result in a memory leak?
>
>  thanks
>  --
>  View this message in context: 
> http://www.nabble.com/Wicket%2C-Hibernate-and-Models-tp16025532p16025532.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]
>
>

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



Wicket, Hibernate and Models

2008-03-13 Thread carloc

Hi everyone,

I have been reading wicket in action recently and I have seen pitfalls of
hibernate section.
I was wondering about the stuff about hibernate and memory leaks due to
hibernate proxy objects maintaining a reference to the session with them


Am I doing this wrong then?
@SpringBean
private UserService userService;

add(new ListView("user", userService.findUsers() {
})

is this wrong? I'm using it directly meaning it will be stored in the page
store right?

should i be doing this instead?

LoadableDetachableModel model = new LoadableDetachablemodel() {
Object load() {
   return usrService.findUsers()
   }

}
}

add(new ListView("listView", model)) {
}

this is to avoid storing the users in the session...
will doing the first one actually result in a memory leak?

thanks
-- 
View this message in context: 
http://www.nabble.com/Wicket%2C-Hibernate-and-Models-tp16025532p16025532.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]