-->
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.  [ 1 post ] 
Author Message
 Post subject: Overwriting table problem
PostPosted: Thu Sep 02, 2004 9:03 am 
Newbie

Joined: Thu Sep 02, 2004 8:33 am
Posts: 6
Hibernate version: 2.1.6

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping package="nl.test">
<class name="nl.test.Werknemer" table="werknemer">
<id
column="naam"
name="Naam"
type="string"
>
<generator class="assigned" />
</id>
<property
column="werknemerId"
length="10"
name="WerknemerId"
not-null="false"
type="string"
/>
<property
column="postcode"
length="7"
name="Postcode"
not-null="false"
type="string"
/>
<property
column="woonplaats"
length="50"
name="Woonplaats"
not-null="false"
type="string"
/>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Session sess = sf.openSession();
try {
tx = sess.beginTransaction();
sess.save(werknemer);
tx.commit();
} catch (HibernateException e) {
if (tx!=null) tx.rollback();
throw e;
}
finally {
sess.flush();
sess.close();
}
Full stack trace of any exception that occurs:
no exceptions

Name and version of the database you are using:
mysql 4.0.18

I'am using JSF to make a werknemer in J2EE and hibernate to store it in mysql.
everything is working fine. I have just one little problem every time that i insert a [werknemer] he overwrite the other values in the table werknemer.

any suggestions or help would be appreciated.

Bart.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.