-->
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: Dirty Checking for detached object
PostPosted: Sat Feb 12, 2005 6:46 pm 
Newbie

Joined: Sat Feb 12, 2005 6:27 pm
Posts: 1
I am aware of hibernates Automatic dirty checking capabilities if the entity is loaded and modified in the same session. But how does this work in the case of detached instances. What we do is load the object in one session close it and save the same with a different session after the object returned from the web tier. The problem is the genrated update sql includes all the columns in the table even though the intention is to save 2 or three columns. Any input is grately appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 13, 2005 6:03 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
this has been discussed many time + you have to read hibernate in action


tips:
versionning + lock(obj,LockMode.READ)
or select-before-update
also see dynamic-update

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 14, 2005 3:29 am 
Beginner
Beginner

Joined: Mon Sep 06, 2004 9:36 am
Posts: 35
Hi Anthony,

i am trying to understand how to use hibernate with web-tier.

I have created an EJB which has a method "retrieveEmployeePosition" to retrieve data. It returns a POJO.

public EmployeePosition retrieveEmployeePosition( Integer employeeId ) {
HibernateUtil.getSession();
HibernateUtil.beginTransaction();
...
HibernateUtil.commitTransaction();
HibernateUtil.closeSession();
return aEmployeePostion;
}

i have a jsp which calls this EJB method to retrieve the data:

EmployeePosition aEmployeePosition = aEmployeeDelegate.retrieveEmployeePosition( employeeId );

then i show the data in different html controls (textbox etc) using aEmployeePosition.getxxx()

my question is should i save the aEmployeePosition on my web-tier and if yes then where? what hibernate recommends?

when user makes the changes and want to update the database then what should be the line of action w.r.t hibernate?

Please reply.


Thanks

JY


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.