MyEclipse Forums
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Author Message
vaibhavkhanna
Post subject: error in hibernate : executed in myeclipse  PostPosted: Jul 27, 2010 - 12:42 PM



Joined: Jul 27, 2010
Posts: 2

error is : log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
/hibernate.cfg.xml not found
Exception in thread "main" java.lang.NullPointerException
at dto.working.main(working.java:28)


code:

package dto;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class working {
public static void main(String[] args) {
Session session = null;
try{

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
Addresses obj1 = new Addresses();
obj1.setAddressid(1);
obj1.setChangedate(null);
obj1.setChangeuserid(null);
obj1.setCity("delhi");
obj1.setHouseno("187");
obj1.setStreet("rohini");
obj1.setZip("110085");
obj1.setCountries("India");
obj1.setCreationdate(null);
session.save(obj1);
} catch(Exception e){
System.out.println(e.getMessage());
}finally{
// Actual contact insertion will happen at this step
session.flush();
session.close();

}
}
}
 
 View user's profile Send private message  
Reply with quote Back to top
support-joy
Post subject: RE: error in hibernate : executed in myeclipse  PostPosted: Jul 28, 2010 - 05:05 AM
Registered Member
Registered Member


Joined: Feb 03, 2009
Posts: 3442


_________________
Joy
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits