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 po

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

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 impl

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

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 d

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

2008-11-03 Thread JulianS
Oops...I meant: Bar bar = myApi.getBar(); List 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 tim

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

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 ProxyMo

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 >

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(sti

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 p

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

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

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

2008-09-29 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

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 copi

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 i

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, 20

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:

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

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'r

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

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 loa

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 o