Hello, I'm tryin to map a single class to 2 different tables, but i'm having some problems in making it work. I've tried the approach listed here
http://www.coderanch.com/t/492558/ORM/databases/Mapping-POJO-table-Hibernate-XML
i created 2 xml that referes to the same class, the xml code is pretty much the same, only difference is that one field of my pojos is loaded from different tables with a join, while the remaining fields are all being loaded for the main table (I have an "Item" pojo, with some attributes loaded from the Item table, and an int quantity, which is loaded from the Order table or the Storage table).
<class name="model.MyClass" table="tab1" entity-name="entity1"> and <class name="model.MyClass" table="tab2" entity-name="entity2">
and declared them in the hibernate.cfg.xml like this
<mapping resource="model/entity1.hbm.xml" />
but i keep getting errors.
To be more specific, I started creating the mapping for tab1, and everything works untill i add the entity-name tag, even with only 1 xml mapping..
Thanks for any input
|