michaelcourcy wrote:
Have a look there
http://www.hibernate.org/hib_docs/annot ... le/#d0e788Don't you need a @MappedSuperclass in this situation ?
MappedSuperclass does not help in my situation. I want to use two different session factories, each uses different database. There are some classes that should be used in both of them but mapped to different tables (For example class SomeClass should be mapped to Table1 in DB1 and to Table2 in DB2). SomeClass is the part of the existing API and I do not want to refactor it to have superclass.
Annotation mappings can be overridden through XML
http://www.hibernate.org/hib_docs/annot ... iding.html
but I don't want to mix up xml and annotations.
The simplest approach here is to create copy of that class for different factories but I'd like to reuse the same class.