I have the following code and let me know if this is the right way
Code:
public Personal getPersonalId(String id) {
// TODO Auto-generated method stub
session = getHibernateTemplate().getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
Query query = getHibernateTemplate().getSessionFactory().openSession().createSQLQuery("SELECT * FROM PERSONAL P WHERE P.ID = ?").addEntity(Personal.class).setInteger(0, Integer.valueOf(id));
System.out.println(query.toString());
tx.commit();
return (Personal)query.uniqueResult();
}
When I print on console get the following
SQLQueryImpl(SELECT * FROM PERSONAL P WHERE P.ID = ?)
Apparently I'm not having a good parameter
Anyone can tell me where I am failing?