|
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>
|