I have two tables table1 and table2 which are exactly same in regard to the Schema and the Composite IDs. The only difference is the data which is present in them. The first table has 4 months of data and the other table has 21 months of data. In my application I need the who data of both the tables. Here we cannot have association between this two tables as the data dont fall in any scenario.
I have tried to join the two tables 2 different pojos using an FULL JOIN in HQL query but its asked for a path to join which mean there should be some association between the entities to join in hibernate.
I also tried a single pojo for both the tables as they are exactly similar except the data in them. For this I have used the hibernate feature entity-name. But its giving me an error as below;
**persistent class not known: MainClass**
This is the HBM which I m using to map the table to the entity:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated Nov 2, 2014 7:23:43 PM by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class name="pojos.MainClass"
table="table1" entity-name="table1">
<composite-id class="pojos.CompositeID"
name="compositeID">
<key-property name="*****" type="string">
<column name="*****" length="5" />
</key-property>
<key-property name="*****" type="string">
<column name="*****" length="3" />
</key-property>
<key-property name="*****" type="string">
<column name="******" length="3" />
</key-property>
<key-property name="****" type="string">
<column name="****" length="7" />
</key-property>
</composite-id>
<property name="****" type="string">
<column name="****" length="7" />
</property>
<one-to-one name="otherClass"
class="pojos.OtherClass"></one-to-one>
</class>
<class name="pojos.MainClass"
table="table2" entity-name="table2">
<composite-id class="pojos.CompositeID"
name="compositeID">
<key-property name="*****" type="string">
<column name="*****" length="5" />
</key-property>
<key-property name="*****" type="string">
<column name="*****" length="3" />
</key-property>
<key-property name="*****" type="string">
<column name="******" length="3" />
</key-property>
<key-property name="****" type="string">
<column name="****" length="7" />
</key-property>
</composite-id>
<property name="****" type="string">
<column name="****" length="7" />
</property>
<one-to-one name="otherClass"
class="pojos.OtherClass"></one-to-one>
</class>
</hibernate-mapping>
Please suggest me which would be the best approach for getting all the data without duplicates from the both identical tables.
Thanks. Sujith G