-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: query of Joined table returns duplicate entries
PostPosted: Mon Apr 05, 2010 2:02 pm 
Newbie

Joined: Mon Sep 24, 2007 8:11 am
Posts: 16
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.