-->
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.  [ 7 posts ] 
Author Message
 Post subject: Can't do simple update
PostPosted: Fri Jan 27, 2006 5:24 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0.5
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.siemens.swa.domain.DistributionCenterSTC"
table="DISTRIBUTION_CENTER_STC"
dynamic-update="true"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
lazy="true"
batch-size="6">


<id
name="id"
column="DISTRIBUTION_CENTER_STC_ID"
type="java.lang.Long"
>
<generator class="native"/>
</id>

<property
name="modemModelSeries"
column="MODEM_MODEL_SERIES"
not-null="true"
type="java.lang.String"
unique="true"
update="true"
insert="true"
/>

<property
name="inclusionDate"
column="INCLUSION_DATE"
not-null="true"
type="java.util.Calendar"
update="true"
insert="true"
/>

<property
name="matricula"
column="MATRICULA"
type="java.lang.String"
update="true"
insert="true"
/>

<property
name="action"
column="ACTION"
not-null="true"
type="java.lang.String"
update="true"
insert="true"
/>

<property
name="stcMovementStatus"
column="STC_MOVEMENT_STATUS"
type="java.lang.Integer"
update="true"
insert="true"
/>

<property
name="stcOperationStatus"
column="STC_OPERATION_STATUS"
type="java.lang.Integer"
update="true"
insert="true"
/>

<property
name="dateUpdated"
column="DATE_UPDATED"
type="java.util.Calendar"
update="true"
insert="true"
/>

</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
DistributionCenterSTC stc;
Query query =
getSession().createQuery(strQuery);
query.setParameter("modemModelSeries", pnsnConcatenado);
stc =
(DistributionCenterSTC) query.uniqueResult();
if (stc != null) {
logger.debug("found!!");
}
stc.setModemModelSeries(pnsnConcatenado);
stc.setInclusionDate(dataHoraInclusao);
stc.setMatricula(matriculaDoTecnico);
stc.setAction(acao);
if (logger.isDebugEnabled()) {
logger.debug("ajustEquipament, "
+ "update vars: "
+ "ModemModelSeries: " + stc.getModemModelSeries()
+ "acao: " + stc.getAction()
+ "mat: " + stc.getMatricula());
}

getSession().flush();

Full stack trace of any exception that occurs:
na
Name and version of the database you are using:
mysql 4.1 - not using innodb
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
2006-01-27 18:18:27,545 [org.springframework.orm.hibernate3.SessionFactoryUtils] - Opening Hibernate Session
2006-01-27 18:18:27,545 [org.hibernate.impl.SessionImpl] - opened session at timestamp: 4662858168504320
2006-01-27 18:18:27,547 [org.hibernate.impl.SessionImpl] - find: SELECT dist FROM DistributionCenterSTC dist WHERE dist.modemModelSeries = :modemModelSeries
2006-01-27 18:18:27,547 [org.hibernate.engine.QueryParameters] - named parameters: {modemModelSeries=777}
2006-01-27 18:18:27,547 [org.hibernate.hql.classic.QueryTranslatorImpl] - compiling query
2006-01-27 18:18:27,556 [org.hibernate.hql.classic.QueryTranslatorImpl] - HQL: SELECT dist FROM com.siemens.swa.domain.DistributionCenterSTC dist WHERE dist.modemModelSeries = :modemModelSeries
2006-01-27 18:18:27,557 [org.hibernate.hql.classic.QueryTranslatorImpl] - SQL: select distributi0_.DISTRIBUTION_CENTER_STC_ID as DISTRIBU1_, distributi0_.MODEM_MODEL_SERIES as MODEM2_143_, distributi0_.INCLUSION_DATE as INCLUSION3_143_, distributi0_.MATRICULA as MATRICULA143_, distributi0_.ACTION as ACTION143_, distributi0_.STC_MOVEMENT_STATUS as STC6_143_, distributi0_.STC_OPERATION_STATUS as STC7_143_, distributi0_.DATE_UPDATED as DATE8_143_ from DISTRIBUTION_CENTER_STC distributi0_ where (distributi0_.MODEM_MODEL_SERIES=? )
2006-01-27 18:18:27,557 [org.hibernate.jdbc.AbstractBatcher] - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2006-01-27 18:18:27,557 [org.hibernate.jdbc.ConnectionManager] - opening JDBC connection
2006-01-27 18:18:27,566 [org.hibernate.SQL] - select distributi0_.DISTRIBUTION_CENTER_STC_ID as DISTRIBU1_, distributi0_.MODEM_MODEL_SERIES as MODEM2_143_, distributi0_.INCLUSION_DATE as INCLUSION3_143_, distributi0_.MATRICULA as MATRICULA143_, distributi0_.ACTION as ACTION143_, distributi0_.STC_MOVEMENT_STATUS as STC6_143_, distributi0_.STC_OPERATION_STATUS as STC7_143_, distributi0_.DATE_UPDATED as DATE8_143_ from DISTRIBUTION_CENTER_STC distributi0_ where (distributi0_.MODEM_MODEL_SERIES=? )
2006-01-27 18:18:27,566 [org.hibernate.jdbc.AbstractBatcher] - preparing statement
2006-01-27 18:18:27,566 [org.hibernate.type.StringType] - binding '777' to parameter: 1
2006-01-27 18:18:27,567 [org.hibernate.jdbc.AbstractBatcher] - about to open ResultSet (open ResultSets: 0, globally: 0)
2006-01-27 18:18:27,567 [org.hibernate.loader.Loader] - processing result set
2006-01-27 18:18:27,567 [org.hibernate.loader.Loader] - result set row: 0
2006-01-27 18:18:27,567 [org.hibernate.type.LongType] - returning '1' as column: DISTRIBU1_
2006-01-27 18:18:27,568 [org.hibernate.loader.Loader] - result row: EntityKey[com.siemens.swa.domain.DistributionCenterSTC#1]
2006-01-27 18:18:27,568 [org.hibernate.loader.Loader] - Initializing object from ResultSet: [com.siemens.swa.domain.DistributionCenterSTC#1]
2006-01-27 18:18:27,568 [org.hibernate.persister.entity.BasicEntityPersister] - Hydrating entity: [com.siemens.swa.domain.DistributionCenterSTC#1]
2006-01-27 18:18:27,568 [org.hibernate.type.StringType] - returning '777' as column: MODEM2_143_
2006-01-27 18:18:27,579 [org.hibernate.type.CalendarType] - returning '2006-01-27 19:00:28' as column: INCLUSION3_143_
2006-01-27 18:18:27,579 [org.hibernate.type.StringType] - returning null as column: MATRICULA143_
2006-01-27 18:18:27,579 [org.hibernate.type.StringType] - returning '77' as column: ACTION143_
2006-01-27 18:18:27,579 [org.hibernate.type.IntegerType] - returning null as column: STC6_143_
2006-01-27 18:18:27,579 [org.hibernate.type.IntegerType] - returning null as column: STC7_143_
2006-01-27 18:18:27,579 [org.hibernate.type.CalendarType] - returning null as column: DATE8_143_
2006-01-27 18:18:27,579 [org.hibernate.loader.Loader] - done processing result set (1 rows)
2006-01-27 18:18:27,579 [org.hibernate.jdbc.AbstractBatcher] - about to close ResultSet (open ResultSets: 1, globally: 1)
2006-01-27 18:18:27,579 [org.hibernate.jdbc.AbstractBatcher] - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2006-01-27 18:18:27,579 [org.hibernate.jdbc.AbstractBatcher] - closing statement
2006-01-27 18:18:27,580 [org.hibernate.loader.Loader] - total objects hydrated: 1
2006-01-27 18:18:27,580 [org.hibernate.engine.TwoPhaseLoad] - resolving associations for [com.siemens.swa.domain.DistributionCenterSTC#1]
2006-01-27 18:18:27,580 [org.hibernate.engine.TwoPhaseLoad] - done materializing entity [com.siemens.swa.domain.DistributionCenterSTC#1]
2006-01-27 18:18:27,580 [org.hibernate.engine.PersistenceContext] - initializing non-lazy collections
2006-01-27 18:18:27,580 [org.hibernate.jdbc.JDBCContext] - after autocommit
2006-01-27 18:18:27,580 [org.hibernate.impl.SessionImpl] - after transaction completion
2006-01-27 18:18:27,580 [org.springframework.orm.hibernate3.SessionFactoryUtils] - Opening Hibernate Session
2006-01-27 18:18:27,580 [org.hibernate.impl.SessionImpl] - opened session at timestamp: 4662858168647680
2006-01-27 18:18:27,585 [org.hibernate.engine.Cascades] - id unsaved-value: null
2006-01-27 18:18:27,586 [org.hibernate.event.def.AbstractSaveEventListener] - detached instance of: com.siemens.swa.domain.DistributionCenterSTC
2006-01-27 18:18:27,586 [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] - updating detached instance
2006-01-27 18:18:27,586 [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] - updating [com.siemens.swa.domain.DistributionCenterSTC#1]
2006-01-27 18:18:27,593 [org.hibernate.event.def.DefaultSaveOrUpdateEventListener] - updating [com.siemens.swa.domain.DistributionCenterSTC#1]
2006-01-27 18:18:27,594 [org.springframework.orm.hibernate3.SessionFactoryUtils] - Opening Hibernate Session
2006-01-27 18:18:27,594 [org.hibernate.impl.SessionImpl] - opened session at timestamp: 4662858168705024

Hi all,

I can insert a row fine, but cannot update the row. This is an existing app, and everything is working fine except this one part. I've read the docs - please excuse if I missed something obvious!

My code is showing the new vars properly, and the 'gets' on the entity are showing the values have been received, but the values are not getting put in the db.

Looking at this log - my object is detached. Hmm, why is that ?

Please help.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 27, 2006 5:57 pm 
Newbie

Joined: Wed Feb 23, 2005 1:02 pm
Posts: 13
Location: Sacramento, CA
why don't you post your Java code that is doing the update?...
short of that, you've probably already considered wrapping the update in a transaction and issuing a "commit" at the end... right?

_________________
-Joel Thompson

http://www.rhinosystemsinc.com
Specializing in Oracle, Java and J2EE Systems for Unix and Windows platforms


Top
 Profile  
 
 Post subject: update sql
PostPosted: Sat Jan 28, 2006 5:15 pm 
Newbie

Joined: Thu Nov 17, 2005 1:29 pm
Posts: 12
Also, I didn't see the update sql in your log. Perhaps you didn't include that part of the file, or the execution of the update is not being called.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 8:21 am 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
Thanks for the replies. I'm still stuck. I'm sure I'm making a simple mistake. There is no update sql being issued, and for some reason the object I'm trying to update is detached. flush() should update the object.

Here's the enitire method:

Code:
   /**
     * @see com.siemens.swa.dao.STCDAO#createOrUpdateDistCenterAdjustment
     * (Calendar, String, String, String)
     * handleDefaultTimeout(ReturnWebBase, String)
     */
    public void createOrUpdateDistCenterAdjustment(Calendar dataHoraInclusao,
            String pnsnConcatenado, String matriculaDoTecnico, String acao) {
       
        String strQuery = "SELECT dist "
            + "FROM DistributionCenterSTC dist "
            + "WHERE dist.modemModelSeries "
            + " = :modemModelSeries ";

        try {

            DistributionCenterSTC stc;
            Query query =
                getSession().createQuery(strQuery);
            query.setParameter("modemModelSeries", pnsnConcatenado);
            stc =
                (DistributionCenterSTC) query.uniqueResult();
            if (stc != null) {
                logger.debug("found!!");
            }
            stc.setModemModelSeries(pnsnConcatenado);
            stc.setInclusionDate(dataHoraInclusao);
            stc.setMatricula(matriculaDoTecnico);
            stc.setAction(acao);
            if (logger.isDebugEnabled()) {
                logger.debug("ajustEquipament, "
                    + "update vars: "
                    + "ModemModelSeries: " + stc.getModemModelSeries()
                    + "acao: " + stc.getAction()
                    + "mat: " + stc.getMatricula());
            }
            // getSession().merge(stc);
            // getSession().update(stc);
            getSession().flush();

        } catch (HibernateException e) {
            throw convertHibernateAccessException(e);
        }

    }


Notice I tried both update() and merge(), still no updates:

here's the mapping file:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.siemens.swa.domain.DistributionCenterSTC"
table="DISTRIBUTION_CENTER_STC"
dynamic-update="true"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
lazy="true"
batch-size="6">


<id
name="id"
column="DISTRIBUTION_CENTER_STC_ID"
type="java.lang.Long"
>
<generator class="native"/>
</id>

<property
name="modemModelSeries"
column="MODEM_MODEL_SERIES"
not-null="true"
type="java.lang.String"
unique="true"
update="true"
insert="true"
/>

<property
name="inclusionDate"
column="INCLUSION_DATE"
not-null="true"
type="java.util.Calendar"
update="true"
insert="true"
/>

<property
name="matricula"
column="MATRICULA"
type="java.lang.String"
update="true"
insert="true"
/>

<property
name="action"
column="ACTION"
not-null="true"
type="java.lang.String"
update="true"
insert="true"
/>

<property
name="stcMovementStatus"
column="STC_MOVEMENT_STATUS"
type="java.lang.Integer"
update="true"
insert="true"
/>

<property
name="stcOperationStatus"
column="STC_OPERATION_STATUS"
type="java.lang.Integer"
update="true"
insert="true"
/>

<property
name="dateUpdated"
column="DATE_UPDATED"
type="java.util.Calendar"
update="true"
insert="true"
/>

</class>
</hibernate-mapping>

Please help,
iksrazal


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 9:02 am 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
Posted before cofee. I meant to post the java file related to the mapping.

Code:
package com.siemens.swa.domain;

import java.util.Calendar;

/**
* DistributionCenterSTC generated by hbm2java.
* @author Robert (robert@atlantico.com.br)
* @version 1.0
*/
@SuppressWarnings("serial")
public class DistributionCenterSTC implements SurrogateKey {

    // Fields   

   /**
    * Identificador do DistributionCenterSTC.
    */
    private Long id;

   /**
    * Identificador do modelo_serie_modem.
    */
    private String modemModelSeries;

   /**
    * Identificador do dt_inclusao.
    */
    private Calendar inclusionDate;

   /**
    * Identificador do dt_inclusao.
    */
    private String matricula;

   /**
    * Identificador do ação.
    */
    private String action;


   /**
    * Identificador do stc_movimentacao_status.
    */
    private Integer stcMovementStatus;


   /**
    * Identificador do stc_operacional_status.
    */
    private Integer stcOperationStatus;


   /**
    * Identificador do stc_operacional_status.
    */
    private Calendar dateUpdated;


    // Constructors

    /** default constructor. */
    public DistributionCenterSTC() {
    }
   
    /** constructor with id.
     * @param id The id to set */
    public DistributionCenterSTC(Long id) {
        this.id = id;
    }


    /**
     * @return Returns the action.
     */
    public String getAction() {
        return action;
    }

    /**
     * @param action The action to set.
     */
    public void setAction(String action) {
        this.action = action;
    }

    /**
     * @return Returns the dateUpdated.
     */
    public Calendar getDateUpdated() {
        return dateUpdated;
    }

    /**
     * @param dateUpdated The dateUpdated to set.
     */
    public void setDateUpdated(Calendar dateUpdated) {
        this.dateUpdated = dateUpdated;
    }

    /**
     * @return Returns the id.
     */
    public Long getId() {
        return id;
    }

    /**
     * @param id The id to set.
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return Returns the inclusionDate.
     */
    public Calendar getInclusionDate() {
        return inclusionDate;
    }

    /**
     * @param inclusionDate The inclusionDate to set.
     */
    public void setInclusionDate(Calendar inclusionDate) {
        this.inclusionDate = inclusionDate;
    }

    /**
     * @return Returns the matricula.
     */
    public String getMatricula() {
        return matricula;
    }

    /**
     * @param matricula The matricula to set.
     */
    public void setMatricula(String matricula) {
        this.matricula = matricula;
    }

    /**
     * @return Returns the modemModelSeries.
     */
    public String getModemModelSeries() {
        return modemModelSeries;
    }

    /**
     * @param modemModelSeries The modemModelSeries to set.
     */
    public void setModemModelSeries(String modemModelSeries) {
        this.modemModelSeries = modemModelSeries;
    }

    /**
     * @return Returns the stcMovementStatus.
     */
    public Integer getStcMovementStatus() {
        return stcMovementStatus;
    }

    /**
     * @param stcMovementStatus The stcMovementStatus to set.
     */
    public void setStcMovementStatus(Integer stcMovementStatus) {
        this.stcMovementStatus = stcMovementStatus;
    }

    /**
     * @return Returns the stcOperationStatus.
     */
    public Integer getStcOperationStatus() {
        return stcOperationStatus;
    }

    /**
     * @param stcOperationStatus The stcOperationStatus to set.
     */
    public void setStcOperationStatus(Integer stcOperationStatus) {
        this.stcOperationStatus = stcOperationStatus;
    }

    /**
     * Returns <code>true</code> if this <code>DistributionCenterSTC</code> is the same as the o argument.
     *
     * @return <code>true</code> if this <code>DistributionCenterSTC</code> is the same as the o argument.
     */
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null) {
            return false;
        }
        if (o.getClass() != getClass()) {
            return false;
        }
        DistributionCenterSTC castedObj = (DistributionCenterSTC) o;
        return ((this.id == null ? castedObj.id == null : this.id
            .equals(castedObj.id))
            && (this.modemModelSeries == null
                ? castedObj.modemModelSeries == null
                : this.modemModelSeries.equals(castedObj.modemModelSeries))
            && (this.inclusionDate == null
                ? castedObj.inclusionDate == null
                : this.inclusionDate.equals(castedObj.inclusionDate))
            && (this.matricula == null
                ? castedObj.matricula == null
                : this.matricula.equals(castedObj.matricula))
            && (this.action == null ? castedObj.action == null : this.action
                .equals(castedObj.action))
            && (this.stcMovementStatus == null
                ? castedObj.stcMovementStatus == null
                : this.stcMovementStatus.equals(castedObj.stcMovementStatus))
            && (this.stcOperationStatus == null
                ? castedObj.stcOperationStatus == null
                : this.stcOperationStatus.equals(castedObj.stcOperationStatus)) && (this.dateUpdated == null
            ? castedObj.dateUpdated == null
            : this.dateUpdated.equals(castedObj.dateUpdated)));
    }

    /**
     * Override hashCode.
     *
     * @return the Objects hashcode.
     */
    public int hashCode() {
        int hashCode = 1;
        hashCode = 31 * hashCode + (id == null ? 0 : id.hashCode());
        hashCode = 31
            * hashCode
            + (modemModelSeries == null ? 0 : modemModelSeries.hashCode());
        hashCode = 31
            * hashCode
            + (inclusionDate == null ? 0 : inclusionDate.hashCode());
        hashCode = 31
            * hashCode
            + (matricula == null ? 0 : matricula.hashCode());
        hashCode = 31 * hashCode + (action == null ? 0 : action.hashCode());
        hashCode = 31
            * hashCode
            + (stcMovementStatus == null ? 0 : stcMovementStatus.hashCode());
        hashCode = 31
            * hashCode
            + (stcOperationStatus == null ? 0 : stcOperationStatus.hashCode());
        hashCode = 31
            * hashCode
            + (dateUpdated == null ? 0 : dateUpdated.hashCode());
        return hashCode;
    }

    public String toString() {
            StringBuffer buffer = new StringBuffer();
            buffer.append("[DistributionCenterSTC:");
            buffer.append(" id: ");
            buffer.append(id);
            buffer.append(" modemModelSeries: ");
            buffer.append(modemModelSeries);
            buffer.append(" inclusionDate: ");
            buffer.append(inclusionDate);
            buffer.append(" matricula: ");
            buffer.append(matricula);
            buffer.append(" action: ");
            buffer.append(action);
            buffer.append(" stcMovementStatus: ");
            buffer.append(stcMovementStatus);
            buffer.append(" stcOperationStatus: ");
            buffer.append(stcOperationStatus);
            buffer.append(" dateUpdated: ");
            buffer.append(dateUpdated);
            buffer.append("]");
            return buffer.toString();
        }

   
}


Top
 Profile  
 
 Post subject: why won't it update
PostPosted: Mon Jan 30, 2006 12:28 pm 
Newbie

Joined: Thu Nov 17, 2005 1:29 pm
Posts: 12
What happens if you use save(stc) instead of update?

Nathan


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 2:33 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
Thanks for the help. save() works fine - I first put the object into the db this way, then I tried updating it and got problems.

This is turning out to be a spring issue - when I drop to just using hibernate, its fine. Here's an example of jumping out of spring and back into pure hibernate:

Code:
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.siemens.swa.domain.DistributionCenterSTC;

/** DAO Handling STC operations. */
public class STCDAOImpl extends HibernateDaoSupport implements STCDAO {

    class UpdateCallback implements HibernateCallback {
       
        Calendar cal;
        String pnsn;
        String action;
       
        public UpdateCallback (final Calendar dataHoraInclusao,
                final String pnsnConcatenado, final String acao) {
            this.cal = dataHoraInclusao;
            this.pnsn = pnsnConcatenado;
            this.action = acao;
        }
       
        public Object doInHibernate(Session session) throws HibernateException {
           
            String strQuery = "SELECT dist "
                + "FROM DistributionCenterSTC dist "
                + "WHERE dist.modemModelSeries "
                + " = :modemModelSeries ";
           
            try {
                DistributionCenterSTC stc;
               
                Query q = session.createQuery(strQuery);
                q.setString("modemModelSeries", pnsn);
                stc = (DistributionCenterSTC) q.uniqueResult();
                if (stc != null) {
                    logger.debug("found!!");
                }
                stc.setInclusionDate(cal);
                stc.setAction(action);
                if (logger.isDebugEnabled()) {
                    logger.debug("ajustEquipament, "
                        + "update vars: "
                        + "ModemModelSeries: " + stc.getModemModelSeries()
                        + "acao: " + stc.getAction()
                        + "mat: " + stc.getMatricula());
                }
                getSession().saveOrUpdate(stc);
                getSession().flush();

               
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            return null;
        }
    }
   
    /**
     * @see com.siemens.swa.dao.STCDAO#createOrUpdateDistCenterAdjustment
     * (Calendar, String, String, String)
     * handleDefaultTimeout(ReturnWebBase, String)
     */
    public void createOrUpdateDistCenterAdjustment(Calendar dataHoraInclusao,
            String pnsnConcatenado, String matriculaDoTecnico, String acao) {
       
        try {
            HibernateTemplate ht = getHibernateTemplate();
            ht.execute(new UpdateCallback(
                    dataHoraInclusao, pnsnConcatenado, acao));
        } catch (HibernateException e) {
            throw convertHibernateAccessException(e);
        }
    }


Here's what some helpful person on the spring list had to say:

"It appears that for each query you are using a different session and that's why the returned objects are disconnected - the session used to load them has been closed. If you are using OSIV [Open session in view], then probably you have a problem with your configuration or you are not using the thread-bound session. Move your code inside a HiberanteCallback."

iksrazal


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