-->
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: Hibernate does not update pojo
PostPosted: Wed Dec 13, 2006 5:41 pm 
Newbie

Joined: Wed Dec 13, 2006 2:24 pm
Posts: 2
Hello everyone,

I've got a problem that makes frustrate me, it is as follows:

First it is a Web JSF application (myfaces, facelets) with Spring and,
obviously Hibernate. There is a POJO wich is read and mantained as variable
at application level, when I try to update it the hibernate log shows that
it is going under updating without any problem. However, when i look up in
the DB the info was actually not updated. I've tried by many differents
methods, from inserting one by one to a sql query.executeUpdate(...), making
flush and without it to the hibernate session, i deactivate the cache and
even though nothing happens, when i execute the sql generated by Hibernate
on my SQLconsole, this one does make the updating but from application
nothing happens.

I hope someone can help me with this since I'm run out of my resources and I
don't know what else I can do to get that updating.

The POJO is as follows:

Code:
public class NotificacionCompanhia extends
SimpleAuditValueObjectAdapter {
   private static final long serialVersionUID = 1L;
   private int notificacionId;
   private String titulo = "";
  private String contenido = "";
  . . .




this is the mapping:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping
DTD 3.0//EN"

     "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
   <class name="mx.com.capsi.commons.hbm.NotificacionCompanhia"
           mutable="true"
           dynamic-update="true"
           table="WEBMASTER.WBMF_NOTXCIA">
       <id name="NotificacionId" type="int" column="WBM_NOT_ID">
           <generator class="sequence"/>
       </id>

       <property name="Titulo"    column="WBM_NCI_TITULO"
type="string"
length="32" not-null="true"/>
       <property name="Contenido" column="WBM_NCI_CONTENIDO"
type="string"
length="1999"/>

   </class>
</hibernate-mapping>


here is when the upgrade is commanded:


Code:
   public void update(ParametrosCompanhia params) {
       Session sess = getSession();
       sess.update(params);
       for(NotificacionCompanhia notificacion:
params.getNotificaciones())
           sess.update(notificacion);
       sess.flush();
   }



and this is the output from the log:


Code:
Hibernate: update WEBMASTER.WBMF_PARAMETROSIS set WBM_PAR_FLMANTE=?,
WBM_PCI_MAXINT=?, WBM_PCI_DIASEXPPWD=?, WBM_PAR_ROWUSER=?,
WBM_PAR_ROWDATE=?, WBM_PAR_UPUSER=?, WBM_PAR_UP_DATE=?,
WBM_FLT_DELETE=?
where WBM_PAR_ID=?
Hibernate: update WEBMASTER.WBMF_PARXCIA set WBM_CIA_ID=?,
WBM_PAR_ID=?,
WBM_ROL_CAD=?, WBM_ROL_SUC=?, WBM_ROL_ADM=?, WBM_PCI_LONPWD=?,
WBM_PCI_TAMHIST=?, WBM_PCI_URLREPFAC=?, WBM_PCI_TCON=?,
WBM_PCI_EXTFAC=?,
WBM_PCI_PERSRV=?, WBM_PCI_ANTFAC=?, WBM_PCI_DIASFECENT=?,
WBM_IMGDET_ID=?,
WBM_PCI_SRVFAC=?, WBM_PCI_ROWUSER=?, WBM_PCI_ROWDATE=?,
WBM_PCI_UPUSER=?,
WBM_PCI_UP_DATE=?, WBM_FLT_DELETE=? where WBM_PCI_ID=?
Hibernate: update WEBMASTER.WBMF_NOTXCIA set WBM_NCI_TITULO=?,
WBM_NCI_CONTENIDO=?, WBM_NCI_ROWUSER=?, WBM_NCI_ROWDATE=?,
WBM_NCI_UPUSER=?,
WBM_NCI_UP_DATE=?, WBM_FLT_DELETE=?, WBM_CIA_ID=? where WBM_NOT_ID=?
Hibernate: update WEBMASTER.WBMF_NOTXCIA set WBM_NCI_TITULO=?,
WBM_NCI_CONTENIDO=?, WBM_NCI_ROWUSER=?, WBM_NCI_ROWDATE=?,
WBM_NCI_UPUSER=?,
WBM_NCI_UP_DATE=?, WBM_FLT_DELETE=?, WBM_CIA_ID=? where WBM_NOT_ID=?
Hibernate: update WEBMASTER.WBMF_NOTXCIA set WBM_NCI_TITULO=?,
WBM_NCI_CONTENIDO=?, WBM_NCI_ROWUSER=?, WBM_NCI_ROWDATE=?,
WBM_NCI_UPUSER=?,
WBM_NCI_UP_DATE=?, WBM_FLT_DELETE=?, WBM_CIA_ID=? where WBM_NOT_ID=?
Hibernate: update WEBMASTER.WBMF_NOTXCIA set WBM_NCI_TITULO=?,
WBM_NCI_CONTENIDO=?, WBM_NCI_ROWUSER=?, WBM_NCI_ROWDATE=?,
WBM_NCI_UPUSER=?,
WBM_NCI_UP_DATE=?, WBM_FLT_DELETE=?, WBM_CIA_ID=? where WBM_NOT_ID=?
Hibernate: update WEBMASTER.WBMF_NOTXCIA set WBM_NCI_TITULO=?,
WBM_NCI_CONTENIDO=?, WBM_NCI_ROWUSER=?, WBM_NCI_ROWDATE=?,
WBM_NCI_UPUSER=?,
WBM_NCI_UP_DATE=?, WBM_FLT_DELETE=?, WBM_CIA_ID=? where WBM_NOT_ID=?
Hibernate: update WEBMASTER.WBMF_NOTXCIA set WBM_NCI_TITULO=?,
WBM_NCI_CONTENIDO=?, WBM_NCI_ROWUSER=?, WBM_NCI_ROWDATE=?,
WBM_NCI_UPUSER=?,
WBM_NCI_UP_DATE=?, WBM_FLT_DELETE=?, WBM_CIA_ID=? where WBM_NOT_ID=?
Hibernate: update WEBMASTER.WBMF_NOTXCIA set WBM_NCI_TITULO=?,
WBM_NCI_CONTENIDO=?, WBM_NCI_ROWUSER=?, WBM_NCI_ROWDATE=?,
WBM_NCI_UPUSER=?,
WBM_NCI_UP_DATE=?, WBM_FLT_DELETE=?, WBM_CIA_ID=? where WBM_NOT_ID=?
Hibernate: update WEBMASTER.WBMF_NOTXCIA set WBM_NCI_TITULO=?,
WBM_NCI_CONTENIDO=?, WBM_NCI_ROWUSER=?, WBM_NCI_ROWDATE=?,
WBM_NCI_UPUSER=?,
WBM_NCI_UP_DATE=?, WBM_FLT_DELETE=?, WBM_CIA_ID=? where WBM_NOT_ID=?
Hibernate: update WEBMASTER.WBMF_NOTXCIA set WBM_NCI_TITULO=?,
WBM_NCI_CONTENIDO=?, WBM_NCI_ROWUSER=?, WBM_NCI_ROWDATE=?,
WBM_NCI_UPUSER=?,
WBM_NCI_UP_DATE=?, WBM_FLT_DELETE=?, WBM_CIA_ID=? where WBM_NOT_ID=?
Hibernate: update WEBMASTER.WBMF_NOTXCIA set WBM_NCI_TITULO=?,
WBM_NCI_CONTENIDO=?, WBM_NCI_ROWUSER=?, WBM_NCI_ROWDATE=?,
WBM_NCI_UPUSER=?,
WBM_NCI_UP_DATE=?, WBM_FLT_DELETE=?, WBM_CIA_ID=? where WBM_NOT_ID=?





Thank you
TrentCioran


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 13, 2006 5:58 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
put it inside a transaction and call transaction.commit to persist the updates to the database

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 14, 2006 12:36 pm 
Newbie

Joined: Wed Dec 13, 2006 2:24 pm
Posts: 2
kochcp wrote:
put it inside a transaction and call transaction.commit to persist the updates to the database



Hi, i'm using spring for the transaction stuff at business service level:

Code:
   <!-- TRANSACTION MANAGEMENT CONFIGURATION -->
   <bean id="transactionManager"
      class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory">
         <ref bean="sessionFactory" />
      </property>
   </bean>
   <!-- Template for  transaction intercetor -->
   <bean id="matchAllWithPropReq"
      class="org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource">
      <property name="transactionAttribute">
         <value>PROPAGATION_REQUIRED</value>
      </property>
   </bean>
   <!-- Transaction Interceptor set up to do PROPAGATION_REQUIRED on all methods -->
   <bean id="matchAllTxInterceptor"
      class="org.springframework.transaction.interceptor.TransactionInterceptor">
      <property name="transactionManager">
         <ref bean="transactionManager" />
      </property>
      <property name="transactionAttributeSource">
         <ref bean="matchAllWithPropReq" />
      </property>
   </bean>



i don't know why this pojo is the only one that have that problem, the rest is working fine =(


Thank you
TrentCioran


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.