Hibernate returns a wrong Entity
<p>here the scenario:</p>

<p>my first method executes a hibernate query on a entity SContact.class.</p>

<p>Withing the first method a second method is called to query on SContactX.class.</p>

<p>Whenever the second query is fired hibernate throws the following exception:</p>

<p><strong><em>javax.persistence.PersistenceException: org.hibernate.WrongClassException: Object [id=1-1A5V6Z] was not of the specified subclass [com.qvc.crm.esp.entity.siebel.SContactX] : loaded object was of wrong class class com.qvc.crm.esp.entity.siebel.SContact</em></strong></p>

<p>Here the first method:</p>

<pre><code> @Override
    @Transactional(value = "transactionManagerAftReplicDb", readOnly = true)
    public List&lt;SContact&gt; identifyCustomers(CompanyCode companyCode, CustomerSearchSpec customerSearchSpec) throws ApplicationException {
            List&lt;SContact&gt; resultList = null;
        QueryBuilder criteria = new QueryBuilder(SContact.class).equals(customerSearchSpec.getSearchFieldName(), customerSearchSpec.getSearchFieldValue())
                .equals("buId", resultListBu.get(0).getRowId());
        QueryConfig queryConfig = new QueryConfig(criteria, getEntityManager());
        queryConfig.withEnd(customerSearchSpec.getCustomerLimit().intValue());
        resultList = queryConfig.query(SContact.class); // executes a query agains SContact
        map(resultList); // executes a query agains SContactX
        return resultList;
    }



 @Override
    public List&lt;Customer&gt; map(List&lt;SContact&gt; contacts) {
        List&lt;Customer&gt; foundCustomer = new ArrayList&lt;Customer&gt;();
        if (CollectionUtils.isNotEmpty(contacts)) {
            for (SContact contact : contacts) {
                SContactX contactExt = loadContextExt(contact);
                ...
            }
        }
        return foundCustomer;
    }

  @Transactional(value = "transactionManagerAftReplicDb", readOnly = true)
    private SContactX loadContextExt(SContact contact) {
        TypedQuery&lt;SContactX&gt; query = getEntityManager().createQuery("FROM SContactX where rowId = :rowId", SContactX.class);
        query.setParameter("rowId", contact.getRowId());
        SContactX result = query.getSingleResult(); // thows exception!
        return result;
    }
</code></pre>

<p>SCONTACT:</p>

<pre><code>  @Entity
@Table(name = "S_CONTACT")
@SuppressWarnings("serial")
public class SContact extends SiebelBaseEntity {
</code></pre>

<p>SCONTACTX:</p>

<pre><code>  @SuppressWarnings("serial")
@Entity
@Table(name = "S_CONTACT_X")
public class SContactX extends SiebelBaseEntity {
</code></pre>

<p>SIEBELBASEENTITY:</p>

<pre><code>@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@SuppressWarnings("serial")
public abstract class SiebelBaseEntity extends BaseEntity {
</code></pre>

<p>BASEENTITY.</p>

<pre><code>public abstract class BaseEntity implements Serializable {
</code></pre>