openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Johnson (JIRA)" <>
Subject [jira] Created: (OPENJPA-162) @OrderBy on @OneToMany does not allow ordering by @Id value
Date Mon, 05 Mar 2007 04:11:50 GMT
@OrderBy on @OneToMany does not allow ordering by @Id value

                 Key: OPENJPA-162
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
    Affects Versions: 0.9.6
         Environment: Using PostgreSQL 8.1 as the database
            Reporter: Nick Johnson

Using the following annotation:

   @OneToMany(mappedBy="root", fetch=FetchType.LAZY)
    @OrderBy("objectId ASC")
    private List<Message> messages;

I get the exception "Cannot order "net.spatula.tally_ho.model.MessageRoot.messages" on "objectId",
because that field is not in the default fetch group.  You can only order on fields that will
be selected when the related object is loaded."

I should certainly hope that the primary key of the related object is going to be selected
when the object is loaded:

    @Column(name = "object_id")
    private long objectId;

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message