JPA: how to organize multiple databases having the same schema definition?
836522May 18 2011 — edited May 20 2011Hi there,
I'm new to Java EE but I could finish some test projects on GlassFish 3 / Java EE 6 platform.
Now it's time to build the actual system and I need some help in that.
So, I can't really tell you the exact purpose of this system but let's look at the following example which is very close to what I need.
Say there is a database schema definition (DDL) for Oracle 11g and this schema is storing the inventory of a shop. So tables like product, category, price etc
Say there are 50 shops, and I'm getting a new database for each shop every month holding their inventory.
So every month I'm receiving a SQL file with INSERTs (DML) for every shop for the DDL I mentioned above.
I'm getting 50 SQL files for the 50 shops every month, so in a year you're talking about 600 SQL files to import.
If it was php/MySQL I could import them into a separate database each, call it shop1_May11, shop2_May11 etc reflecting the shop name and the month in the database name.
This is my question how you guys think I should achieve this in Jave EE / Oracle.
As the DDL is the same I thought to create an Entity for each table and use the Java Persistance API to create the databases and then I'd import the month/shop specific SQL files.
But this means I'm gonna create 50 new schemas in Oracle every month?
Or what's the best way to achieve this?
Thanks in advance
Edited by: 833519 on May 18, 2011 5:28 AM
Edited by: 833519 on May 18, 2011 5:29 AM
Edited by: 833519 on May 18, 2011 5:31 AM