I have created a class (DeleteFilesTask) extended from a base class (PostTxTask). I have annotated the tables to be joined as below:
Code:
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
abstract public class PostTxTask extends BaseManagedObject
@Entity
@PrimaryKeyJoinColumn(name = "PROCESS_ID")
public class DeleteFilesTask extends PostTxTask
I have a test that creates 1 DeleteFilesTask, When I query the base table using Criteria, it returns 2 identical entries that have the same id. When I change to using Query, it returns 1 row as expected. Below are the 2 code samples:
Code:
// This query retirns 1 entry, as expected
Query query = (Query) txFactory.getSession(tx).createQuery("from PostTxTask");
List<PostTxTask> tasks = query.list();
// This query returns 2 identical entries
Criteria criteria = txFactory.getSession(tx).createCriteria(PostTxTask.class);
List<PostTxTask> tasks = criteria.list();
Any idea what I might be doing wrong in the Criteria case?
Thanks