Browsed by
Tag: spring sessionfactory hibernate

Multiple databases using hibernate annotations

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> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/DatabaseOne</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password"></property> <!– Making autocommit false –> <property name="hibernate.connection.autocommit">false</property> <!– Displaying sql queries when…

Read More Read More

979 total views, 1 views today