facebook

error in hibernate : executed in myeclipse

  1. MyEclipse Archived
  2.  > 
  3. Documentation
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #310114 Reply

    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();

    }
    }
    }

    #310123 Reply

    support-joy
    Member
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: error in hibernate : executed in myeclipse

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in