It's not a secret anymore!
The moose likes Object Relational Mapping and the fly likes JPA (HIbernate) with Multiple Database Schemas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA (HIbernate) with Multiple Database Schemas" Watch "JPA (HIbernate) with Multiple Database Schemas" New topic

JPA (HIbernate) with Multiple Database Schemas

Yohan Liyanage
Ranch Hand

Joined: Aug 17, 2007
Posts: 132


I have a requirement to modify an existing application which has been written using JPA (with Hibernate, and JBoss Cache is enabled) to support multiple database schemas (Oracle). The idea is to support multiple clients using different schemas, but to have only a single running instance of the application. The application should select the schema dynamically.

This is to support multi-tenancy, but re-designing the application by adding new columns to identify records for each client is not an option at the moment.

My question is, is this possible ? If so, how can I achieve this ?

I took a look at Hibernate Shards, but that does not seem to solve my problem, as what I am after is not horizontal partitioning.

Thanks a lot.


Yohan Liyanage
I agree. Here's the link:
subject: JPA (HIbernate) with Multiple Database Schemas
jQuery in Action, 3rd edition