-->
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.  [ 2 posts ] 
Author Message
 Post subject: getResultList generates duplicate rows
PostPosted: Sun Apr 06, 2008 1:10 am 
Newbie

Joined: Sun Apr 06, 2008 1:01 am
Posts: 1
I am running Hibernate as my JPA implementation.

I execute the code below. It generates good SQL, and the resulting list has the right number of objects, but the same object (matching the first row returned by the SQL) is repeated each time. Am I doing something wrong?

Hibernate version: 3.2.4.sp1 (JPA)

[b]Code between sessionFactory.openSession() and session.close():


Code:
        private Long topNodeId = 723;
        customDataApplications = em.createQuery("SELECT cda FROM CustomDataApplication cda where cda.topNodeId = :nodeId").
                setParameter("nodeId", topNodeId).getResultList();


Name and version of the database you are using: Oracle 10g

[b]The generated SQL (show_sql=true):


Code:
    select
        customdata0_.top_node_id as top1_54_,
        customdata0_.custom_data_key as custom3_54_,
        customdata0_.node_type_code as node2_54_
    from
        custom_data_application customdata0_
    where
        customdata0_.top_node_id=?


Thanks,
ken clark


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 06, 2008 2:29 am 
Beginner
Beginner

Joined: Fri Aug 24, 2007 4:46 am
Posts: 36
Location: Bielefeld / Germany
Please try a "select distinct cda from CustomDataApplication cda ..."

And please read:

http://www.hibernate.org/117.html#A12

HTH, Maik


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

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.