Hello, I am new to Hibernate
I was working on 2 web applications where they shared some data such as "User" table.
So, I created schema for each applications and a schema for shared data in MySQL , lets take it : msns, msns1, shared
I assigned all authority of these schemas to a single user
Assume that those schema have these tables msns: table1
msns1: table2
shared: user
msns.table1.userid will cross schema referencing shared.user.id
msns1.table2.userid will also cross schema referencing shared.user.id
In hibernate.cfg.xml, I will have this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://192.168.1.147:3306/msns</property>
<property name="hibernate.connection.username">msns</property>
<property name="hibernate.connection.password">msns</property>
<property name="hibernate.current_session_context_class">thread</property>
</session-factory>
</hibernate-configuration>
Now here is my problems:
1. Is there other way to access other schemas regardless which default schema at the connection URL.
When I tried to create the hibernate.reveng.xml, it only allowed table selection from schema "msns", how should i manually edit it to include selection tables from "msns1" and "shared"?
2. Even I able to select tables from "msns1" and "shared", is Hibernate able to generate the proper relationship POJO class and Hashmap?
I tried reverse engineer with seperate hibernate.reveng, table1 has userid as Interger datatype instead of having it as User class?
3. Schemas in mysql refer as database? catalogs is a collection of schemas/databases? this really make me confused during selection of table with
Code:
<schema-selection match-catalog="">
vs
<schema-selection match-schema="">
4. I heard Hibernate Shard will work on this, anyone can provide suggestion on this?