• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts 2 with hibernate insertion exception

 
Ram naveen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
i am using struts 2 with hibernate 3.0 for inserting data in to a table called Login.

this is the code.

sessionFactory = new Configuration().configure("/hibernate.cfg.xml").buildSessionFactory();

Session session= sessionFactory.openSession();
Transaction tx = null;
try {
tx=session.beginTransaction();
Login loginfile = new Login();
loginfile.setId(56);
loginfile.setName("Guru Ragavendra");
session.save(loginfile);
tx.commit();
}catch (RuntimeException e) {
if(tx != null) tx.rollback();
throw e;
} finally {
session.close();
}


but while inserting it throws an exception of this kind

Caused by: org.postgresql.util.PSQLException: ERROR: relation "login" does not exist

could any one guide me to overcome this problem
regards,
Ram
 
Ram naveen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
futher it shows this type of error

WARNING: SQL Error: 0, SQLState: 42P01
Oct 6, 2008 12:56:05 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: ERROR: relation "login" does not exist
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

Do you have a Hibernate mapping file for your Login entity?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic