Hibernate: An AnnotationConfiguration instance is required to use ... error

If you have that error, and you are using hibernate version >=4.0, the problem probably is in the Hibernate Console configuration.

Try to go to:

Run -> Run Configurations

and open the configuration that you have created, On the main tab change Type from Core to Annotations. Here a screenshot: enter image description here


Just change Configuration() to AnnotationConfiguration()


I have changed my code from

Configuration cfg=new Configuration();
            cfg.configure("hibernate.cfg.xml");         
            SessionFactory factory=cfg.buildSessionFactory();

To

SessionFactory factory=new AnnotationConfiguration().configure("hibernate.cfg.xml").buildSessionFactory();

Also I havent added "@Id" annotations in my POJO class. After adding "@Id" I resolved my problem completly.