This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibenate app

 
ishan uttarwar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have develop mini hibernate application but it is throwing errors.
The client app as follows:
import org.hibernate.cfg.Configuration;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.Session;
import org.hibernate.HibernateException;
class insertclient
{
public static void main(String[] args)
{
try
{
//This step will read hibernate.cfg.xml
Configuration conf=new Configuration();
Configuration cf=conf.configure();
SessionFactory factory=cf.buildSessionFactory();
Session session=factory.openSession();
//create new instance of contact and set values in it
Transaction tx=session.beginTransaction();
Empbean emp=new Empbean();
emp.setId(101);
emp.setFname("ishan");
emp.setLanme("uttarwar");
emp.setEmail("ishan.uttarwar@gmail.com");
session.save(emp);
tx.commit();
session.close();
}
catch (HibernateException e)
{
e.printStackTrace();
}

}//main
}//class
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use code tags when posting code.

What do the error messages say?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic