Hello *,
at the moment i am working on a project using hibernate.
We usa a mysql db. Only one database but multiple schemata.
I tried creating one sessionfactory (and one hibernate.cfg.xml) for each schemata and it worked without problems.
I think it would be cleaner and much easier to maintain only one sessionfactory for all schemata/schemas.
The documantation mentions that it is possible and i found several postings saying the same, but i havent found any detailed information how it is done.
Here is what i have done so far:
--) add the schema information to the mapping files
<hibernate-mapping schema="abc">
...
</hibernate-mapping>
<hibernate-mapping schema="xyz">
...
</hibernate-mapping>
I dont know how the connection url of the session factory (at hibernat.dfg.xml) should look like. As far as i know, i have to define a schema here, but wich one should i define here??
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:mysql://localhost:3306/abc</property>
</session-factory>
</hibernate-configuration>
any help or hints appreciated
Peter
|