[solved] an annotationconfiguration instance is required to use mapping class

An annotationconfiguration instance is required to use mapping class Error: an annotationconfiguration instance is required to use mapping class Solution: 1. Ensure you have hibernate-annotations.jar file 2. Create the sessionfactory using new AnnotationConfiguration() not using new Configuration(). Eg: SessionFactory hibernateConfig1 = new AnnotationConfiguration().configure(“hibernate1.cfg.xml”).buildSessionFactory(); Recommended Books: 280 total views, no views today

280 total views, no views today

» Read more

Multiple databases using hibernate annotations

Database and Table Structure: DATABASE : DATABASEONE Table: EMPIDNAME EMPID INT(4) EMPNAME VARCHAR(15) DATABASE : DATABASETWO Table : EMPIDSALARY EMPID INT (4) EMPSALARY INT(4) Project Structure: Step 1:┬áHibernate configuration files for both databases: first database (DATABASEONE) hibernate configuration file (hibernate1.cfg.xml): <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!– Database connection configurations –> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

372 total views, no views today

» Read more