Hi,
Just a quick question, what environment are you running hibernate in ? Seems as you have mentioned the @Entity annotation, i am assuming that you are using it in an EJB3/App Server environment (correct me if i am wrong).
The way i would try do it (it might not work) is to define 2 seperate datasources. Then in the persistence.xml I would declare 2 persistence units like so:
Code:
<persistence>
<persistence-unit name="DB1">
<jta-data-source>java:/<datasource 1></jta-data-source>
............................................
</persistence-unit>
<persistence-unit name="DB2">
<jta-data-source>java:/<datasource 2></jta-data-source>
............................................
</persistence-unit>
</persistence>
The you could declare 2 EnityManagers each with a different persistence context.
You also mention that there is no schema attribute for @Entity, which is true. You have to use the @Table attribute like so:
Code:
@Entity
@Table(name = "<table_name>", schema="<schema_name>")
Cheers,
Andy