View Single Post
  #1 (permalink)  
Old 06-15-2007, 09:42 AM
Saritha Saritha is offline
Member
 
Join Date: Jun 2007
Posts: 1
Saritha is on a distinguished road
Friends could u plz give me solution 4 this
Using hibernate i am just trying to insert a record ..... but i thowing exception

Hibernate: select max(id) from check
Exception in thread "main" org.hibernate.TransactionException: Transaction not successfully started
at org.hibernate.transaction.JDBCTransaction.commit(J DBCTransaction.java:100)
at Test.main(Test.java:18)

This is my code .....

Session s = HibernateUtil.currentSession();
Check c = new Check();
c.setName("Sankya-p");
c.setAddress("Isro-p");
Transaction t = s.getTransaction();
s.save(c);
t.commit();
HibernateUtil.closeSession();

and hbm file ....
<class name="Check" table="check">
<id
name="id"
type="integer"
column="id"
>
<generator class="increment"/>
</id>

<property
name="name"
type="string"
column="name"
length="20"
/>
<property
name="address"
type="string"
column="address"
length="20"
/>
</class>
Reply With Quote
Sponsored Links