-->
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: problem in inserting int value in SQL 2000 database
PostPosted: Sun Mar 18, 2007 2:15 pm 
Newbie

Joined: Sun Mar 18, 2007 1:36 pm
Posts: 1
Hi, I am trying to insert a number into SQL DB.

I failed to insert values. I don't see any errors though

my Table:
columns:
TRIALID int type,NUMBER int type

TRIALID is autoincrement and identity






my code:

Trial trial = new Trial();
trial.setNumber(new Integer(1));
TrialDAO tDao = new TrialDAO();
Transaction trnx = HibernateSessionFactory.getSession().getTransaction();
try {
trnx.begin();
tDao.save(trial);
trnx.commit();
tDao.getSession().close();
} catch (HibernateException e) {
// TODO Auto-generated catch block
trnx.rollback();
e.printStackTrace();
}


and my hibernate mapping file:

<hibernate-mapping>
<class name="ourhome.persistence.persist.Trial" table="TRIAL" schema="dbo" catalog="ourhome">
<id name="trialid" type="java.lang.Integer">
<column name="TRIALID" />
<generator class="identity" />
</id>
<property name="number" type="java.lang.Integer">
<column name="number" />
</property>
</class>
</hibernate-mapping>


Pls help me in understanding the mistake


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.