Wicket + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread JulianS

I am experiencing exactly the problem outlined in the subject of this post,
and I would really appreciate any help I can get, as I am under a deadline.
It's the first time I'm using Wicket with JPA, and I just don't understand
why this isn't working. 

I have a Wicket dataprovider that looks like this (I've simplified it a
bit):

public abstract class FooDataProvider extends SortableDataProvider
{
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this); 
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
}

I am using a very standard Spring JPA setup, and my web.xml includes a
OpenEntityManagerInViewFilter. The spring bean is being injected properly,
and my list of Bar is returned correctly. But I get a
LazyInitializationException no matter what I try. What am I doing wrong?

Many thanks,
Julian

-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.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 + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread JulianS

Oops...I meant:

Bar bar = myApi.getBar();
ListFoo foos = bar.getFoos();


JulianS wrote:
 
 I am experiencing exactly the problem outlined in the subject of this
 post, and I would really appreciate any help I can get, as I am under a
 deadline. It's the first time I'm using Wicket with JPA, and I just don't
 understand why this isn't working. 
 
 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):
 
 public abstract class FooDataProvider extends SortableDataProvider
 {
   private static final long serialVersionUID = 1L;
 
   @SpringBean
   protected MyAPI myApi;
   
   public FooDataProvider()
   {
   super();
   // Injects the spring bean
   InjectorHolder.getInjector().inject(this); 
   }
 
   public Iterator iterator(final int first, final int count)
   {
   ListBar bars = myApi.getBars();
   ListFoo foos = bars.getFoos();
   return foos.iterator();
   }
 }
 
 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?
 
 Many thanks,
 Julian
 
 

-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20309299.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 + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread James Perry
Firstly, your code is rather strange. That getFoos() method is not part of
the List Interface API.

Two possible solutions:

The filter chain maybe incorrect in your web.xml. Your
OpenEntityManagerInViewFilter might not be preceding the Wicket filter.
Check that it does precede it.

If you have a deadline then I recommend having one query that retrieving
both foos and bars in one hit. I've never touched JPQL but in Hibernate
Query Language (HQL), one could write this:

select f from Foo f inner join fetch f.boo b where b.id = :id

Good luck,
James.

On Mon, Nov 3, 2008 at 7:04 PM, JulianS [EMAIL PROTECTED] wrote:


 I am experiencing exactly the problem outlined in the subject of this post,
 and I would really appreciate any help I can get, as I am under a deadline.
 It's the first time I'm using Wicket with JPA, and I just don't understand
 why this isn't working.

 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):

 public abstract class FooDataProvider extends SortableDataProvider
 {
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this);
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
 }

 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?

 Many thanks,
 Julian

 --
 View this message in context:
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.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 + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread Igor Vaynberg
what is your dataprovider#model() look like? are you using a loadable
detachable model?

-igor

On Mon, Nov 3, 2008 at 11:04 AM, JulianS [EMAIL PROTECTED] wrote:

 I am experiencing exactly the problem outlined in the subject of this post,
 and I would really appreciate any help I can get, as I am under a deadline.
 It's the first time I'm using Wicket with JPA, and I just don't understand
 why this isn't working.

 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):

 public abstract class FooDataProvider extends SortableDataProvider
 {
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this);
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
 }

 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?

 Many thanks,
 Julian

 --
 View this message in context: 
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.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 + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread JulianS

Igor,

I'm not using a loadable detachable model because I was hoping to get the
list of foos directly from the Bar object, as opposed to having a dedicated
dao method to get the list of foos, which seems to defeat the benefit of
using JPA's object chaining. To answer your question, here's my
implementation of dataprovider#model():

public IModel model(Object object)
{
return new Model((Serializable) object);
}

Of course, it's very possible I'm missing a fundamental point about loadable
detachable models...



igor.vaynberg wrote:
 
 what is your dataprovider#model() look like? are you using a loadable
 detachable model?
 
 -igor
 
 On Mon, Nov 3, 2008 at 11:04 AM, JulianS [EMAIL PROTECTED] wrote:

 I am experiencing exactly the problem outlined in the subject of this
 post,
 and I would really appreciate any help I can get, as I am under a
 deadline.
 It's the first time I'm using Wicket with JPA, and I just don't
 understand
 why this isn't working.

 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):

 public abstract class FooDataProvider extends SortableDataProvider
 {
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this);
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
 }

 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected
 properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?

 Many thanks,
 Julian

 --
 View this message in context:
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20310904.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 + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread JulianS

James, thanks for your reply. I've checked that my
OpenEntityManagerInViewFilter precedes the Wicket filter. And my debug log
indeed shows that it seems to be opening and closing the entity manager
before and after the wicket filter runs. I'm hoping to avoid the type of
query you suggest, but I'm realizing I may need to resort to it.

Julian


msc65jap wrote:
 
 Firstly, your code is rather strange. That getFoos() method is not part of
 the List Interface API.
 
 Two possible solutions:
 
 The filter chain maybe incorrect in your web.xml. Your
 OpenEntityManagerInViewFilter might not be preceding the Wicket filter.
 Check that it does precede it.
 
 If you have a deadline then I recommend having one query that retrieving
 both foos and bars in one hit. I've never touched JPQL but in Hibernate
 Query Language (HQL), one could write this:
 
 select f from Foo f inner join fetch f.boo b where b.id = :id
 
 Good luck,
 James.
 
 On Mon, Nov 3, 2008 at 7:04 PM, JulianS [EMAIL PROTECTED] wrote:
 

 I am experiencing exactly the problem outlined in the subject of this
 post,
 and I would really appreciate any help I can get, as I am under a
 deadline.
 It's the first time I'm using Wicket with JPA, and I just don't
 understand
 why this isn't working.

 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):

 public abstract class FooDataProvider extends SortableDataProvider
 {
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this);
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
 }

 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected
 properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?

 Many thanks,
 Julian

 --
 View this message in context:
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.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]


 
 

-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20310970.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 + spring + jpa/ hibernate = lazy load exception

2008-11-03 Thread Igor Vaynberg
On Mon, Nov 3, 2008 at 2:09 PM, JulianS [EMAIL PROTECTED] wrote:

To answer your question, here's my
 implementation of dataprovider#model():

public IModel model(Object object)
{
return new Model((Serializable) object);
}

 Of course, it's very possible I'm missing a fundamental point about loadable
 detachable models...

yes, you are missing a very fundmental point about models and the
reason for your lazy init exception is that you are using Model. there
are quiet a lot of threads on this list that explain and show how to
fix your error. i suggest you search the archives, read the models
page on the wiki, and go to wicketinaction.com and search for smart
entitymodel.

-igor





 igor.vaynberg wrote:

 what is your dataprovider#model() look like? are you using a loadable
 detachable model?

 -igor

 On Mon, Nov 3, 2008 at 11:04 AM, JulianS [EMAIL PROTECTED] wrote:

 I am experiencing exactly the problem outlined in the subject of this
 post,
 and I would really appreciate any help I can get, as I am under a
 deadline.
 It's the first time I'm using Wicket with JPA, and I just don't
 understand
 why this isn't working.

 I have a Wicket dataprovider that looks like this (I've simplified it a
 bit):

 public abstract class FooDataProvider extends SortableDataProvider
 {
private static final long serialVersionUID = 1L;

@SpringBean
protected MyAPI myApi;

public FooDataProvider()
{
super();
// Injects the spring bean
InjectorHolder.getInjector().inject(this);
}

public Iterator iterator(final int first, final int count)
{
ListBar bars = myApi.getBars();
ListFoo foos = bars.getFoos();
return foos.iterator();
}
 }

 I am using a very standard Spring JPA setup, and my web.xml includes a
 OpenEntityManagerInViewFilter. The spring bean is being injected
 properly,
 and my list of Bar is returned correctly. But I get a
 LazyInitializationException no matter what I try. What am I doing wrong?

 Many thanks,
 Julian

 --
 View this message in context:
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20308559.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]




 --
 View this message in context: 
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p20310904.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 + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread Lutz Müller
It might work if you dont have any ajax on your page. otherwise each ajax call 
happens in a new request and causes your domain object to be retrieved from 
the database.
this way you lose every change made to your object. writing all changes to 
database before detaching can be an option, but then you might persist 
something to your datastore that is in the midst of being edited.
i would be glad to offer a solution to the problems i just brought up, but i 
am struggling with this problem ever since i started using wicket.

On Tuesday 30 September 2008 08:40:11 Nino Saturnino Martinez Vazquez Wael 
wrote:
 Yup the way that I do it too almost down to every line:)

 Michael Sparer wrote:
  When using the OSIV-filter the lazyload exception may only happen if the
  same entity is used among different requests ... sothat it gets detached
  from hibernate. have a look at
  http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetacha
 blemode.html ... that's the way we're doing it
 
  regards,
  Michael
 
  Korbinian Bachl - privat wrote:
   I think it could be something about
missing usage of loadabledetachable model..?
 
  not for me, as the original entity is pulled using an
  loadabledetachableModel via a SortedDataProvider :/
 
  if you look around, the all called solution for this is the
  OpenSessionInViewFilter and the usage of
  bean id=transactionManager
  class=org.springframework.orm.jpa.JpaTransactionManager
  for that (latter one is used by me, too)
 
  However, the OpenSessionInViewFilter will not work with wicket, even if
  mapped to /* in the web.xml
 
  Best,
 
  Korbinian
 
  Nino Saturnino Martinez Vazquez Wael schrieb:
  Hi Korbinian
 
  Im facing the same problems... I also use extended.. So gonna be great
  to see the outcome of this thread.. I think it could be something about
  missing usage of loadabledetachable model..?
 
  Korbinian Bachl - privat wrote:
  Hi,
 
  I'm currently struggling with the famous lazy load exception under
  spring + jpa with wicket.
 
  The problem is, in my case, that i pull an entity from the database
  using a spring-bean (@SpringBean) and JPA (hibernate). Then in the
  wicket class i need to walk the entity tree a bit, based on the needs
  of the user (preloading wont work, as i dont know the direction the
  user wants to walk and the whole entity tree is too complex to grab it
  all at once).
 
  If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy
  load exception (transaction already closed). So I tried to use the
  OpenSessionInViewFilter to solve this, but it just won't work - no
  reason why, as the error stays exactly the same.
 
  Currently I ended up using this:
  @PersistenceContext(type = PersistenceContextType.EXTENDED)
  private EntityManager em;
 
  However, I'm not sure if this is the way it is supposed to be?
  ( I read so far that this disables a big part of springs-transaction
  handling support but didnt see any impacts so far)
 
  Has anyone a different aproach/ solution for this using wicket +
  spring with JPA?
 
  Best,
 
  Korbinan
 
  PS: im on wicket 1.4-m3
 
  -
  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]
 
  -
  Michael Sparer
  http://talk-on-tech.blogspot.com



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread Michael Sparer

you mean changing each property of an existing object by means of ajax? if
the object is serializable, clone the object and perform the changes on that
object ... if it isn't set the properties in your form and apply them
onsubmit ... or am I missing the point completely?


Lutz Müller wrote:
 
 It might work if you dont have any ajax on your page. otherwise each ajax
 call 
 happens in a new request and causes your domain object to be retrieved
 from 
 the database.
 this way you lose every change made to your object. writing all changes to 
 database before detaching can be an option, but then you might persist 
 something to your datastore that is in the midst of being edited.
 i would be glad to offer a solution to the problems i just brought up, but
 i 
 am struggling with this problem ever since i started using wicket.
 
 On Tuesday 30 September 2008 08:40:11 Nino Saturnino Martinez Vazquez Wael 
 wrote:
 Yup the way that I do it too almost down to every line:)

 Michael Sparer wrote:
  When using the OSIV-filter the lazyload exception may only happen if
 the
  same entity is used among different requests ... sothat it gets
 detached
  from hibernate. have a look at
 
 http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetacha
 blemode.html ... that's the way we're doing it
 
  regards,
  Michael
 
  Korbinian Bachl - privat wrote:
   I think it could be something about
missing usage of loadabledetachable model..?
 
  not for me, as the original entity is pulled using an
  loadabledetachableModel via a SortedDataProvider :/
 
  if you look around, the all called solution for this is the
  OpenSessionInViewFilter and the usage of
  bean id=transactionManager
  class=org.springframework.orm.jpa.JpaTransactionManager
  for that (latter one is used by me, too)
 
  However, the OpenSessionInViewFilter will not work with wicket, even
 if
  mapped to /* in the web.xml
 
  Best,
 
  Korbinian
 
  Nino Saturnino Martinez Vazquez Wael schrieb:
  Hi Korbinian
 
  Im facing the same problems... I also use extended.. So gonna be
 great
  to see the outcome of this thread.. I think it could be something
 about
  missing usage of loadabledetachable model..?
 
  Korbinian Bachl - privat wrote:
  Hi,
 
  I'm currently struggling with the famous lazy load exception under
  spring + jpa with wicket.
 
  The problem is, in my case, that i pull an entity from the database
  using a spring-bean (@SpringBean) and JPA (hibernate). Then in the
  wicket class i need to walk the entity tree a bit, based on the
 needs
  of the user (preloading wont work, as i dont know the direction the
  user wants to walk and the whole entity tree is too complex to grab
 it
  all at once).
 
  If I use the Entity myEntity.getMyOtherConnectedEntity I get the
 lazy
  load exception (transaction already closed). So I tried to use the
  OpenSessionInViewFilter to solve this, but it just won't work - no
  reason why, as the error stays exactly the same.
 
  Currently I ended up using this:
  @PersistenceContext(type = PersistenceContextType.EXTENDED)
  private EntityManager em;
 
  However, I'm not sure if this is the way it is supposed to be?
  ( I read so far that this disables a big part of springs-transaction
  handling support but didnt see any impacts so far)
 
  Has anyone a different aproach/ solution for this using wicket +
  spring with JPA?
 
  Best,
 
  Korbinan
 
  PS: im on wicket 1.4-m3
 
 
 -
  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]
 
  -
  Michael Sparer
  http://talk-on-tech.blogspot.com
 
 
 


-
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p19899635.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 + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread Igor Vaynberg
maybe this will help

http://wicketinaction.com/2008/09/building-a-smart-entitymodel/

-igor

On Thu, Oct 9, 2008 at 7:02 AM, Michael Sparer [EMAIL PROTECTED] wrote:

 you mean changing each property of an existing object by means of ajax? if
 the object is serializable, clone the object and perform the changes on that
 object ... if it isn't set the properties in your form and apply them
 onsubmit ... or am I missing the point completely?


 Lutz Müller wrote:

 It might work if you dont have any ajax on your page. otherwise each ajax
 call
 happens in a new request and causes your domain object to be retrieved
 from
 the database.
 this way you lose every change made to your object. writing all changes to
 database before detaching can be an option, but then you might persist
 something to your datastore that is in the midst of being edited.
 i would be glad to offer a solution to the problems i just brought up, but
 i
 am struggling with this problem ever since i started using wicket.

 On Tuesday 30 September 2008 08:40:11 Nino Saturnino Martinez Vazquez Wael
 wrote:
 Yup the way that I do it too almost down to every line:)

 Michael Sparer wrote:
  When using the OSIV-filter the lazyload exception may only happen if
 the
  same entity is used among different requests ... sothat it gets
 detached
  from hibernate. have a look at
 
 http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetacha
 blemode.html ... that's the way we're doing it
 
  regards,
  Michael
 
  Korbinian Bachl - privat wrote:
   I think it could be something about
missing usage of loadabledetachable model..?
 
  not for me, as the original entity is pulled using an
  loadabledetachableModel via a SortedDataProvider :/
 
  if you look around, the all called solution for this is the
  OpenSessionInViewFilter and the usage of
  bean id=transactionManager
  class=org.springframework.orm.jpa.JpaTransactionManager
  for that (latter one is used by me, too)
 
  However, the OpenSessionInViewFilter will not work with wicket, even
 if
  mapped to /* in the web.xml
 
  Best,
 
  Korbinian
 
  Nino Saturnino Martinez Vazquez Wael schrieb:
  Hi Korbinian
 
  Im facing the same problems... I also use extended.. So gonna be
 great
  to see the outcome of this thread.. I think it could be something
 about
  missing usage of loadabledetachable model..?
 
  Korbinian Bachl - privat wrote:
  Hi,
 
  I'm currently struggling with the famous lazy load exception under
  spring + jpa with wicket.
 
  The problem is, in my case, that i pull an entity from the database
  using a spring-bean (@SpringBean) and JPA (hibernate). Then in the
  wicket class i need to walk the entity tree a bit, based on the
 needs
  of the user (preloading wont work, as i dont know the direction the
  user wants to walk and the whole entity tree is too complex to grab
 it
  all at once).
 
  If I use the Entity myEntity.getMyOtherConnectedEntity I get the
 lazy
  load exception (transaction already closed). So I tried to use the
  OpenSessionInViewFilter to solve this, but it just won't work - no
  reason why, as the error stays exactly the same.
 
  Currently I ended up using this:
  @PersistenceContext(type = PersistenceContextType.EXTENDED)
  private EntityManager em;
 
  However, I'm not sure if this is the way it is supposed to be?
  ( I read so far that this disables a big part of springs-transaction
  handling support but didnt see any impacts so far)
 
  Has anyone a different aproach/ solution for this using wicket +
  spring with JPA?
 
  Best,
 
  Korbinan
 
  PS: im on wicket 1.4-m3
 
 
 -
  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]
 
  -
  Michael Sparer
  http://talk-on-tech.blogspot.com





 -
 Michael Sparer
 http://talk-on-tech.blogspot.com
 --
 View this message in context: 
 http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p19899635.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 + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread Nino Saturnino Martinez Vazquez Wael

Hi Lutz

I agree, there is something to this.. However it's not wicket related.. 
I know that Bjarni are hacking away at something, I've dicussed a few 
things with him.


I guess if you are creating entities then you can store your data in a 
temporary model... However Bjarni Gudmondurs thing(still under 
development, he will make post to his blog soon ) will remove the need 
for explicitly defining the temporary class. It follows the builder 
pattern and on the end of the form/wizard whatever you just call 
build... If you are editing stuff then a loadable detachable model 
should be okay if you just persist the changes on each request, if thats 
not okay. Because the editing needs to be confirmed first then you have 
to store your data in a temporary map or something and persist on 
submit.. Theres loads of different ways of handling this, with pros and 
cons. You could also put in an extended persistence context but there 
are performance/memory issues with this if you have too much data, and 
data will be persisted on the fly. But I actually like the fact that we 
get the lazy load exceptions. It tells us that we are not using 
detachable models and our entities have become stale...


Lutz Müller wrote:
It might work if you dont have any ajax on your page. otherwise each ajax call 
happens in a new request and causes your domain object to be retrieved from 
the database.
this way you lose every change made to your object. writing all changes to 
database before detaching can be an option, but then you might persist 
something to your datastore that is in the midst of being edited.
i would be glad to offer a solution to the problems i just brought up, but i 
am struggling with this problem ever since i started using wicket.


On Tuesday 30 September 2008 08:40:11 Nino Saturnino Martinez Vazquez Wael 
wrote:
  

Yup the way that I do it too almost down to every line:)

Michael Sparer wrote:


When using the OSIV-filter the lazyload exception may only happen if the
same entity is used among different requests ... sothat it gets detached
from hibernate. have a look at
http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetacha
blemode.html ... that's the way we're doing it

regards,
Michael

Korbinian Bachl - privat wrote:
  

 I think it could be something about
  missing usage of loadabledetachable model..?

not for me, as the original entity is pulled using an
loadabledetachableModel via a SortedDataProvider :/

if you look around, the all called solution for this is the
OpenSessionInViewFilter and the usage of
bean id=transactionManager
class=org.springframework.orm.jpa.JpaTransactionManager
for that (latter one is used by me, too)

However, the OpenSessionInViewFilter will not work with wicket, even if
mapped to /* in the web.xml

Best,

Korbinian

Nino Saturnino Martinez Vazquez Wael schrieb:


Hi Korbinian

Im facing the same problems... I also use extended.. So gonna be great
to see the outcome of this thread.. I think it could be something about
missing usage of loadabledetachable model..?

Korbinian Bachl - privat wrote:
  

Hi,

I'm currently struggling with the famous lazy load exception under
spring + jpa with wicket.

The problem is, in my case, that i pull an entity from the database
using a spring-bean (@SpringBean) and JPA (hibernate). Then in the
wicket class i need to walk the entity tree a bit, based on the needs
of the user (preloading wont work, as i dont know the direction the
user wants to walk and the whole entity tree is too complex to grab it
all at once).

If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy
load exception (transaction already closed). So I tried to use the
OpenSessionInViewFilter to solve this, but it just won't work - no
reason why, as the error stays exactly the same.

Currently I ended up using this:
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager em;

However, I'm not sure if this is the way it is supposed to be?
( I read so far that this disables a big part of springs-transaction
handling support but didnt see any impacts so far)

Has anyone a different aproach/ solution for this using wicket +
spring with JPA?

Best,

Korbinan

PS: im on wicket 1.4-m3

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


-
Michael Sparer
http://talk-on-tech.blogspot.com
  



  


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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread Timo Rantalaiho
On Thu, 09 Oct 2008, Lutz Müller wrote:
 It might work if you dont have any ajax on your page. otherwise each ajax 
 call 
 happens in a new request and causes your domain object to be retrieved from 
 the database.
 this way you lose every change made to your object. writing all changes to 
 database before detaching can be an option, but then you might persist 
 something to your datastore that is in the midst of being edited.
 i would be glad to offer a solution to the problems i just brought up, but i 
 am struggling with this problem ever since i started using wicket.

The best is if you can use autosave and just persist everything
(valid) always. Often this (combined with undo when needed) is
also a good solution for the user.

If not, at least we are not using detachable models in places 
where editing needs to span several requests.

Other option would be to use separate data transfer object 
style form beans.

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-10-09 Thread James Carman
Are we talking about a wizard here?  What if you used something like this:

https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/model/proxy/ProxyModelManager.java

Basically, the models cache their values until you call commit on
the ProxyModelManager.  So, you can do as many steps in the wizard as
you want and if you base your components on proxied models (that wrap
PropertyModels around a LoadableDetachableModel), then your object
will only be loaded from the database at the end (during the commit
of the proxy models) and you won't lose your edits.

On Thu, Oct 9, 2008 at 10:37 PM, Timo Rantalaiho [EMAIL PROTECTED] wrote:
 On Thu, 09 Oct 2008, Lutz Müller wrote:
 It might work if you dont have any ajax on your page. otherwise each ajax 
 call
 happens in a new request and causes your domain object to be retrieved from
 the database.
 this way you lose every change made to your object. writing all changes to
 database before detaching can be an option, but then you might persist
 something to your datastore that is in the midst of being edited.
 i would be glad to offer a solution to the problems i just brought up, but i
 am struggling with this problem ever since i started using wicket.

 The best is if you can use autosave and just persist everything
 (valid) always. Often this (combined with undo when needed) is
 also a good solution for the user.

 If not, at least we are not using detachable models in places
 where editing needs to span several requests.

 Other option would be to use separate data transfer object
 style form beans.

 Best wishes,
 Timo

 --
 Timo Rantalaiho
 Reaktor Innovations OyURL: http://www.ri.fi/ 

 -
 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 + spring + jpa/ hibernate = lazy load exception

2008-09-30 Thread Nino Saturnino Martinez Vazquez Wael

Yup the way that I do it too almost down to every line:)

Michael Sparer wrote:

When using the OSIV-filter the lazyload exception may only happen if the same
entity is used among different requests ... sothat it gets detached from
hibernate. have a look at
http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetachablemode.html
... that's the way we're doing it

regards,
Michael

Korbinian Bachl - privat wrote:
  

 I think it could be something about
  missing usage of loadabledetachable model..?

not for me, as the original entity is pulled using an 
loadabledetachableModel via a SortedDataProvider :/


if you look around, the all called solution for this is the 
OpenSessionInViewFilter and the usage of
bean id=transactionManager 
class=org.springframework.orm.jpa.JpaTransactionManager

for that (latter one is used by me, too)

However, the OpenSessionInViewFilter will not work with wicket, even if 
mapped to /* in the web.xml


Best,

Korbinian




Nino Saturnino Martinez Vazquez Wael schrieb:


Hi Korbinian

Im facing the same problems... I also use extended.. So gonna be great 
to see the outcome of this thread.. I think it could be something about 
missing usage of loadabledetachable model..?






Korbinian Bachl - privat wrote:
  

Hi,

I'm currently struggling with the famous lazy load exception under 
spring + jpa with wicket.


The problem is, in my case, that i pull an entity from the database 
using a spring-bean (@SpringBean) and JPA (hibernate). Then in the 
wicket class i need to walk the entity tree a bit, based on the needs 
of the user (preloading wont work, as i dont know the direction the 
user wants to walk and the whole entity tree is too complex to grab it 
all at once).


If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy 
load exception (transaction already closed). So I tried to use the 
OpenSessionInViewFilter to solve this, but it just won't work - no 
reason why, as the error stays exactly the same.


Currently I ended up using this:
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager em;

However, I'm not sure if this is the way it is supposed to be?
( I read so far that this disables a big part of springs-transaction 
handling support but didnt see any impacts so far)


Has anyone a different aproach/ solution for this using wicket + 
spring with JPA?


Best,

Korbinan

PS: im on wicket 1.4-m3

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







-
Michael Sparer
http://talk-on-tech.blogspot.com
  


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



wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Korbinian Bachl - privat

Hi,

I'm currently struggling with the famous lazy load exception under 
spring + jpa with wicket.


The problem is, in my case, that i pull an entity from the database 
using a spring-bean (@SpringBean) and JPA (hibernate). Then in the 
wicket class i need to walk the entity tree a bit, based on the needs of 
the user (preloading wont work, as i dont know the direction the user 
wants to walk and the whole entity tree is too complex to grab it all at 
once).


If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy 
load exception (transaction already closed). So I tried to use the 
OpenSessionInViewFilter to solve this, but it just won't work - no 
reason why, as the error stays exactly the same.


Currently I ended up using this:
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager em;

However, I'm not sure if this is the way it is supposed to be?
( I read so far that this disables a big part of springs-transaction 
handling support but didnt see any impacts so far)


Has anyone a different aproach/ solution for this using wicket + spring 
with JPA?


Best,

Korbinan

PS: im on wicket 1.4-m3

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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Nino Saturnino Martinez Vazquez Wael

Hi Korbinian

Im facing the same problems... I also use extended.. So gonna be great 
to see the outcome of this thread.. I think it could be something about 
missing usage of loadabledetachable model..?






Korbinian Bachl - privat wrote:

Hi,

I'm currently struggling with the famous lazy load exception under 
spring + jpa with wicket.


The problem is, in my case, that i pull an entity from the database 
using a spring-bean (@SpringBean) and JPA (hibernate). Then in the 
wicket class i need to walk the entity tree a bit, based on the needs 
of the user (preloading wont work, as i dont know the direction the 
user wants to walk and the whole entity tree is too complex to grab it 
all at once).


If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy 
load exception (transaction already closed). So I tried to use the 
OpenSessionInViewFilter to solve this, but it just won't work - no 
reason why, as the error stays exactly the same.


Currently I ended up using this:
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager em;

However, I'm not sure if this is the way it is supposed to be?
( I read so far that this disables a big part of springs-transaction 
handling support but didnt see any impacts so far)


Has anyone a different aproach/ solution for this using wicket + 
spring with JPA?


Best,

Korbinan

PS: im on wicket 1.4-m3

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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Korbinian Bachl - privat

I think it could be something about
 missing usage of loadabledetachable model..?

not for me, as the original entity is pulled using an 
loadabledetachableModel via a SortedDataProvider :/


if you look around, the all called solution for this is the 
OpenSessionInViewFilter and the usage of
bean id=transactionManager 
class=org.springframework.orm.jpa.JpaTransactionManager

for that (latter one is used by me, too)

However, the OpenSessionInViewFilter will not work with wicket, even if 
mapped to /* in the web.xml


Best,

Korbinian




Nino Saturnino Martinez Vazquez Wael schrieb:

Hi Korbinian

Im facing the same problems... I also use extended.. So gonna be great 
to see the outcome of this thread.. I think it could be something about 
missing usage of loadabledetachable model..?






Korbinian Bachl - privat wrote:

Hi,

I'm currently struggling with the famous lazy load exception under 
spring + jpa with wicket.


The problem is, in my case, that i pull an entity from the database 
using a spring-bean (@SpringBean) and JPA (hibernate). Then in the 
wicket class i need to walk the entity tree a bit, based on the needs 
of the user (preloading wont work, as i dont know the direction the 
user wants to walk and the whole entity tree is too complex to grab it 
all at once).


If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy 
load exception (transaction already closed). So I tried to use the 
OpenSessionInViewFilter to solve this, but it just won't work - no 
reason why, as the error stays exactly the same.


Currently I ended up using this:
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager em;

However, I'm not sure if this is the way it is supposed to be?
( I read so far that this disables a big part of springs-transaction 
handling support but didnt see any impacts so far)


Has anyone a different aproach/ solution for this using wicket + 
spring with JPA?


Best,

Korbinan

PS: im on wicket 1.4-m3

-
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 + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread James Carman
On Mon, Sep 29, 2008 at 7:14 AM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:

 However, the OpenSessionInViewFilter will not work with wicket, even if
 mapped to /* in the web.xml

Huh?  We use it and it works just fine.  By the way, have you tried
OpenEntityManagerInViewFilter if you're using JPA?

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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Michael Sparer

When using the OSIV-filter the lazyload exception may only happen if the same
entity is used among different requests ... sothat it gets detached from
hibernate. have a look at
http://talk-on-tech.blogspot.com/2008/05/custom-reuseable-loadabledetachablemode.html
... that's the way we're doing it

regards,
Michael

Korbinian Bachl - privat wrote:
 
  I think it could be something about
   missing usage of loadabledetachable model..?
 
 not for me, as the original entity is pulled using an 
 loadabledetachableModel via a SortedDataProvider :/
 
 if you look around, the all called solution for this is the 
 OpenSessionInViewFilter and the usage of
 bean id=transactionManager 
 class=org.springframework.orm.jpa.JpaTransactionManager
 for that (latter one is used by me, too)
 
 However, the OpenSessionInViewFilter will not work with wicket, even if 
 mapped to /* in the web.xml
 
 Best,
 
 Korbinian
 
 
 
 
 Nino Saturnino Martinez Vazquez Wael schrieb:
 Hi Korbinian
 
 Im facing the same problems... I also use extended.. So gonna be great 
 to see the outcome of this thread.. I think it could be something about 
 missing usage of loadabledetachable model..?
 
 
 
 
 
 Korbinian Bachl - privat wrote:
 Hi,

 I'm currently struggling with the famous lazy load exception under 
 spring + jpa with wicket.

 The problem is, in my case, that i pull an entity from the database 
 using a spring-bean (@SpringBean) and JPA (hibernate). Then in the 
 wicket class i need to walk the entity tree a bit, based on the needs 
 of the user (preloading wont work, as i dont know the direction the 
 user wants to walk and the whole entity tree is too complex to grab it 
 all at once).

 If I use the Entity myEntity.getMyOtherConnectedEntity I get the lazy 
 load exception (transaction already closed). So I tried to use the 
 OpenSessionInViewFilter to solve this, but it just won't work - no 
 reason why, as the error stays exactly the same.

 Currently I ended up using this:
 @PersistenceContext(type = PersistenceContextType.EXTENDED)
 private EntityManager em;

 However, I'm not sure if this is the way it is supposed to be?
 ( I read so far that this disables a big part of springs-transaction 
 handling support but didnt see any impacts so far)

 Has anyone a different aproach/ solution for this using wicket + 
 spring with JPA?

 Best,

 Korbinan

 PS: im on wicket 1.4-m3

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


-
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/wicket-%2B-spring-%2B-jpa--hibernate-%3D-lazy-load-exception-tp19721199p19722521.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 + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Korbinian Bachl - privat

really? - I tried it but...

would you please be so nice and post the part of the web.xml where it is 
mapped and the corresponding part of the spring-application.xml ?


what wicket version are you on? what runtime (Tomcat 6?)?

Best,

Korbinian


James Carman schrieb:

On Mon, Sep 29, 2008 at 7:14 AM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:


However, the OpenSessionInViewFilter will not work with wicket, even if
mapped to /* in the web.xml


Huh?  We use it and it works just fine.  By the way, have you tried
OpenEntityManagerInViewFilter if you're using JPA?

-
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 + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread James Carman
We don't use JPA at work, but we use OSIV (we're using straight
hibernate).  Anyway, for the JPA configuration, you can look at:

https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml


On Mon, Sep 29, 2008 at 7:57 AM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:
 really? - I tried it but...

 would you please be so nice and post the part of the web.xml where it is
 mapped and the corresponding part of the spring-application.xml ?

 what wicket version are you on? what runtime (Tomcat 6?)?

 Best,

 Korbinian


 James Carman schrieb:

 On Mon, Sep 29, 2008 at 7:14 AM, Korbinian Bachl - privat
 [EMAIL PROTECTED] wrote:

 However, the OpenSessionInViewFilter will not work with wicket, even if
 mapped to /* in the web.xml

 Huh?  We use it and it works just fine.  By the way, have you tried
 OpenEntityManagerInViewFilter if you're using JPA?

 -
 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 + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread Korbinian Bachl - privat

Hmm,

I copied it to web.xml, but result is:

2008-09-29 18:07:24,125 ERROR org.hibernate.LazyInitializationException 
- failed to lazily initialize a collection of role: 
de.xxx....xxx., no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a 
collection of role: de.xxx....xxx., no session or 
session was closed
	at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
	at 
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
	at 
org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)

at org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
..

web.xml looks:

?xml version=1.0 encoding=UTF-8?
web-app xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;

 version=2.4

display-namewhiskas-application/display-name

listener 
listener-classorg.springframework.web.context.ContextLoaderListener/listener-class

/listener

listener 
listener-classorg.springframework.web.context.request.RequestContextListener/listener-class

/listener

!-- ##
  Filters
   ## --

!-- TEST --
filter
filter-nameOpenEntityManagerInViewFilter/filter-name 


filter-classorg.springframework.orm.jpa.support.OpenEntityManagerInViewFilter/filter-class
/filter


!-- Wicket Application --
filter
filter-nameWhiskasApplication/filter-name 
filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class

init-param
param-nameapplicationFactoryClassName/param-name 


param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param

init-param
param-nameconfiguration/param-name
param-valuedeployment/param-value
/init-param
/filter

!-- ##
Filter Mappings
 ## --

filter-mapping
filter-nameOpenEntityManagerInViewFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping


filter-mapping
filter-nameWhiskasApplication/filter-name
url-pattern/*/url-pattern
/filter-mapping


/web-app

so, what can be wrong there? - web.xml seems 100% fine to me. Is there 
anything that has to be put into the application.xml?


Best,

Korbinian


James Carman schrieb:

We don't use JPA at work, but we use OSIV (we're using straight
hibernate).  Anyway, for the JPA configuration, you can look at:

https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml


On Mon, Sep 29, 2008 at 7:57 AM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:

really? - I tried it but...

would you please be so nice and post the part of the web.xml where it is
mapped and the corresponding part of the spring-application.xml ?

what wicket version are you on? what runtime (Tomcat 6?)?

Best,

Korbinian


James Carman schrieb:

On Mon, Sep 29, 2008 at 7:14 AM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:


However, the OpenSessionInViewFilter will not work with wicket, even if
mapped to /* in the web.xml

Huh?  We use it and it works just fine.  By the way, have you tried
OpenEntityManagerInViewFilter if you're using JPA?

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



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



Re: wicket + spring + jpa/ hibernate = lazy load exception

2008-09-29 Thread James Carman
Would you be able to create a quickstart that exhibits this behavior?
If you want, you can use the JPA archetype in wicketopia (the code I
referenced) to set everything up for you automatically.

On Mon, Sep 29, 2008 at 12:21 PM, Korbinian Bachl - privat
[EMAIL PROTECTED] wrote:
 Hmm,

 I copied it to web.xml, but result is:

 2008-09-29 18:07:24,125 ERROR org.hibernate.LazyInitializationException -
 failed to lazily initialize a collection of role:
 de.xxx....xxx., no session or session was closed
 org.hibernate.LazyInitializationException: failed to lazily initialize a
 collection of role: de.xxx....xxx., no session or session
 was closed
at
 org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
at
 org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
at
 org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
at
 org.hibernate.collection.PersistentSet.size(PersistentSet.java:139)
 ..

 web.xml looks:

 ?xml version=1.0 encoding=UTF-8?
 web-app xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
 version=2.4

display-namewhiskas-application/display-name

listener
 listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener

listener
 listener-classorg.springframework.web.context.request.RequestContextListener/listener-class
/listener

!-- ##
  Filters
   ## --

!-- TEST --
filter
filter-nameOpenEntityManagerInViewFilter/filter-name
 filter-classorg.springframework.orm.jpa.support.OpenEntityManagerInViewFilter/filter-class
/filter


!-- Wicket Application --
filter
filter-nameWhiskasApplication/filter-name
 filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param
param-nameapplicationFactoryClassName/param-name
 param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param

init-param
param-nameconfiguration/param-name
param-valuedeployment/param-value
/init-param
/filter

!-- ##
Filter Mappings
 ## --

filter-mapping
filter-nameOpenEntityManagerInViewFilter/filter-name
url-pattern/*/url-pattern
/filter-mapping


filter-mapping
filter-nameWhiskasApplication/filter-name
url-pattern/*/url-pattern
/filter-mapping


 /web-app

 so, what can be wrong there? - web.xml seems 100% fine to me. Is there
 anything that has to be put into the application.xml?

 Best,

 Korbinian


 James Carman schrieb:

 We don't use JPA at work, but we use OSIV (we're using straight
 hibernate).  Anyway, for the JPA configuration, you can look at:


 https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/jpa-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml


 On Mon, Sep 29, 2008 at 7:57 AM, Korbinian Bachl - privat
 [EMAIL PROTECTED] wrote:

 really? - I tried it but...

 would you please be so nice and post the part of the web.xml where it is
 mapped and the corresponding part of the spring-application.xml ?

 what wicket version are you on? what runtime (Tomcat 6?)?

 Best,

 Korbinian


 James Carman schrieb:

 On Mon, Sep 29, 2008 at 7:14 AM, Korbinian Bachl - privat
 [EMAIL PROTECTED] wrote:

 However, the OpenSessionInViewFilter will not work with wicket, even if
 mapped to /* in the web.xml

 Huh?  We use it and it works just fine.  By the way, have you tried
 OpenEntityManagerInViewFilter if you're using JPA?

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


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