[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - using same entity with two different tables

alram do-not-reply at jboss.com
Thu Nov 20 03:50:15 EST 2008


hi,

i have the following question:

i have the same table in two schema. (same columns, same primary key, same tablename, but in another schema) primary i wan't to read and store my entities in the first (primary) table. if the entry there is final, i want to write it in to the table in second schema and remove it from the primary schema.

at the moment, i do not have the schema hardcoded via annotations in the entity class. it comes from datasource XML file, where the default schema is set via the JDBC URL. maybe i can define two persistence units with different default schemas. but i think that can't work, because one entity class can only be bound to one persistenceUnit (as fas as i know).

at the moment i don't know, how i can realize this with JPA. 

another possible solution is, to rename the second table and put it into the primary schema. but how can i adjust the tablename at runtime?

are there people they had similar problems? can anyone give me a hint, how this can be resolved?

thanks to all!




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4190761#4190761

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4190761



More information about the jboss-user mailing list