hi, i got a problem while saving object, but the selection queries running fine. There is no exception throws but object is not persisted even console prints the next value for ID filed like
"11:15:21,656 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Bran
ch_4_0 date=200610162339)] Started in 29s:391ms
11:15:41,812 INFO [STDOUT] Hibernate: select max(cid) from companies
11:15:42,265 INFO [STDOUT] Hibernate: select companyimp0_.cid as cid0_, company
imp0_.company_name as company2_0_ from companies companyimp0_"
My code is
public class CompanyDAOImpl implements CompanyDAO {
SessionFactory sessionFactory;
Session session;
Transaction trans;
java.io.Serializable ser;
public CompanyDAOImpl() {
}
public void insert(CompanyImpl company){
try{
session = this.getCurrentSession();
trans = session.getTransaction();
trans.begin();
session.saveOrUpdate(company);
trans.commit();
java.util.List l= (java.util.List)session.createQuery("from com.springer.impl.CompanyImpl").list();
for(int i=0; i<l.size(); i++){
System.out.println(((CompanyImpl)l.get(i)).companyName);
}
} catch (Exception ex){
ex.printStackTrace();
trans.rollback();
} finally {
session.close();
}
}
Kindly send me comment about to resolve that problem.
thanks
_________________ Kashif Bashir
Mobex Limited kashefbasher@gmail.com
|