-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: update finds an old proxy (i think)
PostPosted: Mon Jan 16, 2006 3:13 pm 
Beginner
Beginner

Joined: Fri Oct 15, 2004 4:54 pm
Posts: 32
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0

i am implementing a (struts) webapp where, for update, i

1. get the form from struts
2. move the values into a transfer object
3. give spring the transfer object.

in the spring layer i:

1. fetch the original data object from the hibernate-dao layer (using load)
2. update the values from the transfer object that have been changed

i then give the data object back to the dao, and call update there, and i am done.

but ... my record doesn't get updated. from what i can tell, hibernate has a look at the object i gave it (which is a proxy), then checks to see if it already has one of these in it's cache. it does, so out goes mine, and update is called with the old one (which, of course, doesn't have the updates). i don't see why my proxy is not the one already in the session cache.

if i leave off my fetch of the original data object and just build a new data object from scratch, the update works fine. the problem there is that i don't push all the data out to the form (e.g. created-by metadata), so i need to have that somewhere (i tested this by putting/getting the transfer object in my http session).

questions: is there something else i should be doing? is my pattern itself flawed? is there a better way to do this? is this a spring thing?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 16, 2006 6:30 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
do you have the same session open all the time or are you opening and closing sessions in between?

Regards Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 16, 2006 6:33 pm 
Beginner
Beginner

Joined: Fri Oct 15, 2004 4:54 pm
Posts: 32
it's the same session. i am using the spring openSessionInViewFilter


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.