-->
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: session.update is not updating records.
PostPosted: Fri Mar 04, 2005 2:32 pm 
Beginner
Beginner

Joined: Mon Nov 29, 2004 5:34 pm
Posts: 35
Hi,
I am using websphere application server and when i give the session.update it does not update the records in database.

and I do not see the SQL statements also.

This particular table does not have the primary key, so my question is if you do not have the primary key for the table, does session.update or session.saveOrupdate will work?

Or what are the other reason for my records not getting updated ?


Thanks in advance.
srigold


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 04, 2005 3:31 pm 
Beginner
Beginner

Joined: Mon Nov 29, 2004 5:34 pm
Posts: 35
I think the problem is that, this table is developed long back and more than 1 application is using this table and i cannot change this table, which does not have the primary key.

And i am using middlegen to generate the mapping files and if you do not have the primary key, it makes all the columns as composite keys and i think we cannot update the keys by giving session.update.

Can somebody suggest others ways to handle this situation, where you do not have primary key and want to update records.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 04, 2005 6:33 pm 
Beginner
Beginner

Joined: Mon Nov 29, 2004 5:34 pm
Posts: 35
My mapping file is and we are using :-
Code:
net.sf.hibernate.transaction.WebSphereTransactionManagerLookup


and sample code to update records is

-------------------------------------------------------------


Code:
aUser.setLastUpdtById(sysUser);
aUserDAO.update(aUser, session);
session.flush();


---------------------------------------------------


Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
"hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.datasource">
jdbc/oracle/cmis
</property>
<!-- Database Settings -->
<property name="hibernate.dialect">
net.sf.hibernate.dialect.Oracle9Dialect
</property>
<property name="hibernate.jdbc.batch_versioned_data">false</property>
<property name="hibernate.jdbc.batch_size">0</property>
<property name="hibernate.default_schema">ADMN</property>
<property name="hibernate.show_sql">true</property>
<!-- Transaction Settings -->
<property name="hibernate.transaction.manager_lookup_class">
net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
</property>
<property name="hibernate.transaction.factory_class">
net.sf.hibernate.transaction.JTATransactionFactory
</property>
<!-- Session Factory Settings -->
<property name="hibernate.session_factory_name">
HibernateSessionFactory
</property>
<!-- Mapping Files - audt_admn schema -->
<mapping resource="xxx/xxx/xxx/audit/domain/AudtHdr.hbm.xml" />

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






Here is my mapping file for class.

--------------------------------------------------------

Quote:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM
"hibernate-mapping-2.0.dtd" >

<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin

http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->

<class name="xxx.xxx.xxx.scrty.domain.ScrtyUser" table="SCRTY_USER" schema="SCRTY_ADMN">

<composite-id>
<key-property name="userId" column="USER_ID" type="java.lang.String" length="8" />
<key-property name="user1stName" column="USER_1ST_NAME" type="java.lang.String" length="30" />
<key-property name="userLastName" column="USER_LAST_NAME" type="java.lang.String" length="30" />
<key-property name="stusCd" column="STUS_CD" type="java.lang.String" length="1" />
<key-property name="stusDt" column="STUS_DT" type="java.sql.Timestamp" length="7" />
<key-property name="lastUpdtDt" column="LAST_UPDT_DT" type="java.sql.Timestamp" length="7" />
<key-property name="lastUpdtById" column="LAST_UPDT_BY_ID" type="java.lang.String" length="8" />
<key-property name="invldPwCnt" column="INVLD_PW_CNT" type="java.lang.Integer" length="2" />
<key-property name="lockNum" column="LOCK_NUM" type="java.lang.Long" length="16" />
<key-property name="id" column="ID" type="java.lang.Long" length="14" />
</composite-id>


<!-- associations -->

</class>
</hibernate-mapping>


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.