Joined: Thu Jun 21, 2007 6:45 am Posts: 1
|
Hello thank you all
I have a problem with update Hibernate 3.1.
I have a Table (not primary key) in SQL Server 2000 and the Hibernate map is
<hibernate-mapping>
<class name="com.myeclipse.hibernate.Dati" table="DATI" schema="dbo" catalog="TestHibernate">
<composite-id name="id" class="com.myeclipse.hibernate.DatiId" unsaved-value="any">
<key-property name="nome" type="java.lang.String">
<column name="NOME" length="50" />
</key-property>
<key-property name="cognome" type="java.lang.String">
<column name="COGNOME" length="50" />
</key-property>
<key-property name="via" type="java.lang.String">
<column name="VIA" length="50" />
</key-property>
<key-property name="numero" type="java.lang.Integer">
<column name="NUMERO" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>
I use this source for update the column NUMERO:
DatiDAO dDAO = new DatiDAO();
List ls = dDAO.findByProperty("id.numero", 5);
dDAO.getSession().close();
if(ls.size() >0) {
for (int i=0 ; i<ls.size(); i++) {
Dati up = ((Dati)ls.get(i));
DatiId upId = up.getId();
upId.setNumero(10);
up.setId(upId);
DatiDAO dDAO1 = new DatiDAO();
Transaction tx = dDAO1.getSession().beginTransaction();
dDAO.getSession().update(upId);
tx.commit();
dDAO1.getSession().close();
}
}
The problem is that i haven't error or exception but i haven't update in my table
Please help me
Thankyou everyone
|
|