-->
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.  [ 10 posts ] 
Author Message
 Post subject: Update not working.. bug???
PostPosted: Tue Jul 05, 2005 2:21 pm 
Newbie

Joined: Fri Jun 24, 2005 3:57 pm
Posts: 11
I am performing an update. When I review the log, I see no errors, but the database is not updated either. I am very confused and am not sure where to even begin to debug this. Any help would be greatly appreciated!

Hibernate version: 3.0

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="org.tiaa.dsvpassthrough.dao.DsvSupport"
table="DSVSUPPORT">

<composite-id name="key" class="org.tiaa.dsvpassthrough.dao.key.DsvSupportKey">
<key-property name="groupName"/>
<key-property name="keyName"/>
</composite-id>

<property name="keyValue"/>

<sql-insert>
INSERT INTO DSVSUPPORT (KEYVALUE, GROUPNAME, KEYNAME, UPDATETIME)
VALUES ( ?, ?, ?, sysdate )
</sql-insert>

</class>

<sql-query name="org.tiaa.dsvpassthrough.dao.DsvSupport">
<return alias="dsvSupport" class="org.tiaa.dsvpassthrough.dao.DsvSupport"/>
SELECT dsvSupport.GROUPNAME AS {dsvSupport.key.groupName},
dsvSupport.KEYNAME AS {dsvSupport.key.keyName},
dsvSupport.KEYVALUE AS {dsvSupport.keyValue}
FROM DSVSUPPORT dsvSupport
ORDER BY dsvSupport.GROUPNAME, dsvSupport.KEYNAME
</sql-query>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
public static void update(DspDao pdaoUpdate) throws DaoException
{
Session ssnDb = HibernateUtil.currentSession();
Transaction txDb = null;

try
{
txDb = ssnDb.beginTransaction();
ssnDb.update(pdaoUpdate);
txDb.commit();
} // end try
catch (HibernateException he)
{
if (null != txDb)
{
txDb.rollback();
} // end if
throw new DaoException("Database error during update.", he);
} // end catch
finally
{
HibernateUtil.closeSession();
} // end finally
} // end update

Full stack trace of any exception that occurs:

Name and version of the database you are using: Oracle 8i

The generated SQL (show_sql=true):
update DSVSUPPORT set keyValue=? where groupName=? and keyName=?

Debug level Hibernate log excerpt:
(2005-07-05 14:09:20,938), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.impl.SessionImpl, (081583022070510101456210001869), (opened session at timestamp: 4589924192002048)
(2005-07-05 14:09:20,938), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.transaction.JDBCTransaction, (081583022070510101456210001869), (begin)
(2005-07-05 14:09:20,953), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.ConnectionManager, (081583022070510101456210001869), (opening JDBC connection)
(2005-07-05 14:09:21,047), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.transaction.JDBCTransaction, (081583022070510101456210001869), (current autocommit status: true)
(2005-07-05 14:09:21,047), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.transaction.JDBCTransaction, (081583022070510101456210001869), (disabling autocommit)
(2005-07-05 14:09:21,047), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.DefaultSaveOrUpdateEventListener, (081583022070510101456210001869), (updating detached instance)
(2005-07-05 14:09:21,047), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.DefaultSaveOrUpdateEventListener, (081583022070510101456210001869), (updating [org.tiaa.dsvpassthrough.dao.DsvSupport#component[groupName,keyName]{keyName=kshkey, groupName=ksh}])
(2005-07-05 14:09:21,047), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.DefaultSaveOrUpdateEventListener, (081583022070510101456210001869), (updating [org.tiaa.dsvpassthrough.dao.DsvSupport#component[groupName,keyName]{keyName=kshkey, groupName=ksh}])
(2005-07-05 14:09:21,063), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.transaction.JDBCTransaction, (081583022070510101456210001869), (commit)
(2005-07-05 14:09:21,063), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.impl.SessionImpl, (081583022070510101456210001869), (automatically flushing session)
(2005-07-05 14:09:21,063), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.AbstractFlushingEventListener, (081583022070510101456210001869), (flushing session)
(2005-07-05 14:09:21,063), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.AbstractFlushingEventListener, (081583022070510101456210001869), (processing flush-time cascades)
(2005-07-05 14:09:21,063), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.AbstractFlushingEventListener, (081583022070510101456210001869), (dirty checking collections)
(2005-07-05 14:09:21,063), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.AbstractFlushingEventListener, (081583022070510101456210001869), (Flushing entities and processing referenced collections)
(2005-07-05 14:09:21,078), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.DefaultFlushEntityEventListener, (081583022070510101456210001869), (Updating entity: [org.tiaa.dsvpassthrough.dao.DsvSupport#component[groupName,keyName]{keyName=kshkey, groupName=ksh}])
(2005-07-05 14:09:21,078), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.AbstractFlushingEventListener, (081583022070510101456210001869), (Processing unreferenced collections)
(2005-07-05 14:09:21,078), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.AbstractFlushingEventListener, (081583022070510101456210001869), (Scheduling collection removes/(re)creates/updates)
(2005-07-05 14:09:21,078), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.AbstractFlushingEventListener, (081583022070510101456210001869), (Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects)
(2005-07-05 14:09:21,078), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.AbstractFlushingEventListener, (081583022070510101456210001869), (Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections)
(2005-07-05 14:09:21,094), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.pretty.Printer, (081583022070510101456210001869), (listing entities:)
(2005-07-05 14:09:21,094), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.pretty.Printer, (081583022070510101456210001869), (org.tiaa.dsvpassthrough.dao.DsvSupport{key=component[groupName,keyName]{keyName=kshkey, groupName=ksh}, keyValue=kshvalue new})
(2005-07-05 14:09:21,094), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.AbstractFlushingEventListener, (081583022070510101456210001869), (executing flush)
(2005-07-05 14:09:21,094), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.persister.entity.BasicEntityPersister, (081583022070510101456210001869), (Updating entity: [org.tiaa.dsvpassthrough.dao.DsvSupport#component[groupName,keyName]{keyName=kshkey, groupName=ksh}])
(2005-07-05 14:09:21,094), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.AbstractBatcher, (081583022070510101456210001869), (about to open PreparedStatement (open PreparedStatements: 0, globally: 0))
(2005-07-05 14:09:21,109), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.SQL, (081583022070510101456210001869), (update DSVSUPPORT set keyValue=? where groupName=? and keyName=?)
(2005-07-05 14:09:21,109), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.AbstractBatcher, (081583022070510101456210001869), (preparing statement)
(2005-07-05 14:09:21,109), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.persister.entity.BasicEntityPersister, (081583022070510101456210001869), (Dehydrating entity: [org.tiaa.dsvpassthrough.dao.DsvSupport#component[groupName,keyName]{keyName=kshkey, groupName=ksh}])
(2005-07-05 14:09:21,109), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.type.StringType, (081583022070510101456210001869), (binding 'kshvalue new' to parameter: 1)
(2005-07-05 14:09:21,109), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.type.StringType, (081583022070510101456210001869), (binding 'ksh' to parameter: 2)
(2005-07-05 14:09:21,125), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.type.StringType, (081583022070510101456210001869), (binding 'kshkey' to parameter: 3)
(2005-07-05 14:09:21,125), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.AbstractBatcher, (081583022070510101456210001869), (Adding to batch)
(2005-07-05 14:09:21,125), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.AbstractBatcher, (081583022070510101456210001869), (Executing batch size: 1)
(2005-07-05 14:09:21,172), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.AbstractBatcher, (081583022070510101456210001869), (success of batch update unknown: 0)
(2005-07-05 14:09:21,172), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.AbstractBatcher, (081583022070510101456210001869), (about to close PreparedStatement (open PreparedStatements: 1, globally: 1))
(2005-07-05 14:09:21,172), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.AbstractBatcher, (081583022070510101456210001869), (closing statement)
(2005-07-05 14:09:21,187), 66200-HOYINGK, c310-s2, dsp, DEBUG, hibernate.event.def.AbstractFlushingEventListener, (081583022070510101456210001869), (post flush)
(2005-07-05 14:09:21,187), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.JDBCContext, (081583022070510101456210001869), (before transaction completion)
(2005-07-05 14:09:21,187), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.impl.SessionImpl, (081583022070510101456210001869), (before transaction completion)
(2005-07-05 14:09:21,234), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.transaction.JDBCTransaction, (081583022070510101456210001869), (re-enabling autocommit)
(2005-07-05 14:09:21,234), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.transaction.JDBCTransaction, (081583022070510101456210001869), (committed JDBC Connection)
(2005-07-05 14:09:21,234), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.JDBCContext, (081583022070510101456210001869), (after transaction completion)
(2005-07-05 14:09:21,250), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.impl.SessionImpl, (081583022070510101456210001869), (after transaction completion)
(2005-07-05 14:09:21,250), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.impl.SessionImpl, (081583022070510101456210001869), (closing session)
(2005-07-05 14:09:21,250), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.ConnectionManager, (081583022070510101456210001869), (closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)])
(2005-07-05 14:09:21,250), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.jdbc.JDBCContext, (081583022070510101456210001869), (after transaction completion)
(2005-07-05 14:09:21,250), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibernate.impl.SessionImpl, (081583022070510101456210001869), (after transaction completion)
(2005-07-05 14:09:21,250), 66200-HOYINGK, c310-s2, dsp, DEBUG, org.hibe


Top
 Profile  
 
 Post subject: Same issue with Deletes!
PostPosted: Tue Jul 05, 2005 2:23 pm 
Newbie

Joined: Fri Jun 24, 2005 3:57 pm
Posts: 11
Only thing that seems to work is an add. Here is my config file if that will help....

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

<!-- Database connection settings - Set manually in code -->

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.OracleDialect</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Set this property in code instead so that it pulls from dspInit.xml
and therfore does not have to be configured in two places
<property name="connection.datasource">DSV_SUPPORT_DS</property>
-->

<!--
<property name="transaction.manager_lookup_class">
org.hibernate.transaction.WeblogicTransactionManagerLookup
</property>
<property name="transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
-->
<property name="transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory
</property>

<mapping resource="DsvSupport.hbm.xml"/>
<mapping resource="DsrAppParams.hbm.xml"/>

</session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject: Same problem
PostPosted: Tue Sep 27, 2005 7:33 am 
Newbie

Joined: Tue Sep 27, 2005 7:30 am
Posts: 12
I have the exact same problem.
Have you been able to resolve this?

Thanks


Top
 Profile  
 
 Post subject: Database issue
PostPosted: Tue Sep 27, 2005 10:55 am 
Newbie

Joined: Fri Jun 24, 2005 3:57 pm
Posts: 11
My problem was a database issue. The database key fields were defined as CHAR instead of VARCHAR. As a result, they were padded with spaces for values that were shorter than there defined length. I not see teh spaces when querying the table. As a result, the key I was passing in never matched teh key in teh database so updates and deletes were not happening.


Top
 Profile  
 
 Post subject: Problem resolved
PostPosted: Wed Sep 28, 2005 3:51 am 
Newbie

Joined: Tue Sep 27, 2005 7:30 am
Posts: 12
Hi

Thanks for the repsonse.

I've resolved my problem as well. It had to do with me not allowing the container to flush the session.

I'm using container managed transactions and in my finally statements I was calling session.close(). The reason I was calling this explicitly and not allowing the container to do this was because I get a message from JBoss(4.0.2)

09:48:17,464 INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@1fcb00e

At the moment I'm living with this message until I find a solution to get rid it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 3:55 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The solution is to read the documentation of Hibernate about "connection release modes" in the J2EE configuration section.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 4:00 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://www.hibernate.org/120.html#A13


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 5:35 am 
Newbie

Joined: Tue Sep 27, 2005 7:30 am
Posts: 12
Thanks Christian
That worked like a charm.

My settings were
<property name="hibernate.connection.release_mode">after_statement</property>

You guys are really helpful.


Top
 Profile  
 
 Post subject: Using sessionFactory.getCurrentSession()
PostPosted: Wed Sep 28, 2005 11:39 am 
Newbie

Joined: Tue Sep 27, 2005 7:30 am
Posts: 12
Hi

I was originally using HibernateUtil as defined in the Hibernate Reference Guide (3.0.5) to get my session (Getting it from ThreadLocal). This worked fine after changing the hibernate.connection.release_mode to auto.

I then read in the reference guide that we should use sessionFactory.getCurrentSession() if we using CMT transactions which I am currently using. Doing it this way gives me that warning again
17:25:20,327 INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@1ab2f56

My current properties are

Code:
      <property name="show_sql">true</property>
      <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
      <property name="hibernate.connection.datasource">java:jdbc/testXA</property>
      <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
      <property name="hibernate.transaction.flush_before_completion">true</property>
      <property name="hibernate.transaction.auto_close_session">true</property>
      <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
      <property name="hibernate.connection.release_mode">auto</property>


Please let me know if there is another solution to this?

Thanks


Top
 Profile  
 
 Post subject: Sorted out
PostPosted: Thu Sep 29, 2005 9:02 am 
Newbie

Joined: Tue Sep 27, 2005 7:30 am
Posts: 12
Sorry guys

I realised Jboss 4.0.2 had its own hibernate (3.0.2) jar in its class path and this jar was being picked up instead of my 3.0.5 jar.

The warning does not appear once again :-)

Regards
Naeem


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