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>

375 total views, 3 views today

» Read more

Multiple databases using hibernate example

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>

148 total views, no views today

» Read more