[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5561) criteria query returns wrong number of objects for one-to-many relationships, multiplied by number of associated instances

Konstantin Ignatyev (JIRA) noreply at atlassian.com
Mon Sep 13 11:50:18 EDT 2010


criteria query returns wrong number of objects for one-to-many relationships, multiplied by number of associated instances
--------------------------------------------------------------------------------------------------------------------------

                 Key: HHH-5561
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5561
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.5
         Environment: Hibernate 3.5.5 ORACLE and HSQL databases
            Reporter: Konstantin Ignatyev
         Attachments: hibernate-criteria-reprocase.tgz

For this mapping to subclassed objects (Links)
Container_class
    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
    @IndexColumn(base=1, name="item_position")
    @JoinColumn(name="cnt_id", nullable=false)
    @ForeignKey(name="cnt_inlk_fk")
    public List<AbstractLink> getLinks() {
        return links;
    }


When only one object is created with 3 links, and then DB is queried via Criteria
cList = s.createCriteria(Container.class).list();

the result contains 3 objects, should be one.

Please see attached reprocase
mvn test 
should do if repositories are set correctly

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list