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]

Reply via email to