This content has been marked as final. Show 3 replies
I'm not sure JPA is best for this because it looks like you receive a bunch sql statements that you simply need to run against some schema.
Are you creating a backup database for all these shops or is it some kind of a replication strategy?
Will the target database be queried at some point for the data?
yes, we have to use these databases for reports, also, I'd like to be able to generate reports like 'How many sales in May?', so it'll run a JOIN query on every shop*_May11 databases.
So you're saying JPA is best for databases that you don't create ad-hoc?
I simply create the databases for each shop/month and I'll just use normal SQL queries if I need any data?
JPA helps a lot in persisting and retrieving data that has relationships without having to worry about the relationships at a sQL level.
So you get a java programmer that builds relationships using Java classes (the entities) and a persistence provider worries about the sql required to materialize those relationships.
You seem to be using SQL inserts for persisting the data and you want to generate the reports from SQL as well.
You can use it but you won't be gaining much of its advantages for this project.
Consider reporting applications like the jasperserver for the reports.
Also, I have seen people get away with using one database for this type of thing and just adding a clientid (and optionally branchid) to each table.