-->
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.  [ 6 posts ] 
Author Message
 Post subject: data not updated
PostPosted: Fri Nov 07, 2008 10:48 am 
Newbie

Joined: Fri Sep 26, 2008 4:45 am
Posts: 17
Hi,

I cannot update an existing element into my db, I doesn't have any exception

here is my code

Code:
Localisation parcelle = getRemoteParcelleDao().findById(
                                 selectedParcelle.getId());
if (parcelle != null) {
  LOG.debug("PARCELLE EXIST WILL BE UPDATE " + selectedParcelle.getId() + " " + selectedParcelle.getLieuDit() + " AND SELECTED LOCALISATION = " + parcelle.getId() + " " + parcelle.getLieuDit());               
remoteParcelleDao.update(selectedParcelle);
}


And my dao code for update

Code:
   public void update(Localisation parcelle) {
      getHibernateTemplate().update(parcelle);
   }


Top
 Profile  
 
 Post subject: MEthods update (of session)
PostPosted: Fri Nov 07, 2008 12:50 pm 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
u don't really supply a lot of info but I can tell u something, me I've never
got to make work methods of type saveOrUpdate and so. And so, I only use
methods type of save only; no update at all. Effect can be the same if you
distinguish properly from your app.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2008 12:54 pm 
Newbie

Joined: Fri Sep 26, 2008 4:45 am
Posts: 17
that's surprise me, I use update in the whole application and that's work but not for this case


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2008 3:25 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I can't see that you are making any updates to the object you are loading in the first line of your code. If the 'selectedParcelle' is a detached instance you might need to call merge() instead of update().


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 08, 2008 8:01 am 
Newbie

Joined: Fri Sep 26, 2008 4:45 am
Posts: 17
the attribute selectedParcelle is modifyed by jsf ( like #{sessionBean.selectedParcelle.attribute}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2008 3:30 am 
Newbie

Joined: Fri Sep 26, 2008 4:45 am
Posts: 17
It's really strange because I use the same strategy to update other values and it's work

Code:

Requerant requerant = remoteRequerantDao         .findById(selectedAffaireBean.getAffaire().getRequerants   .iterator().next().getId());
if (requerant != null) {
   LOG.debug("REQUERANT ALREADY EXIST IN THE DB\n");
   remoteRequerantDao.update(selectedRequerant);
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.