174 words

Problem with @OrderBy

#1
2011-04-21 05:17

When I use @OrderBy and supply multiple order fields I get and error when ObjectDB Explorer expands a instance of the entity.

Example code:

@Entity
@Table(name="Defects", schema = "myDB")
public class Defects  implements Serializable
{
    ...
    ...
    @OneToMany(mappedBy="defect")
    @OrderBy("seqRel, noteSeq")
    Set<Notes> notes;
    ...
    ...
}

The error is printed on the console where I started the Explorer

Th error that seems most informative is:

Exception in thread "AWT-EventQueue-0" [ObjectDB 2.2.1_02] Query:  SELECT owner FROM Notes owner JOIN owner.defect inverse WHERE inverse = ?1 ORDER BY owner.seqRel,  ==> noteSeq <==
javax.persistence.PersistenceException
Unexpected query token 'noteSeq' (error 752)
(position 98) at java.awt.Component.dispatchEventImpl(Component.java:4652)

The error seems to be the second field "noteSeq" in the above example is referenced as if it were an entity instead of a field of an entity.

If I remove the multiple fields and only use one I do not get any errors.

@OrderBy("seqRel")

Is this a bug or am I using collections and JPA annotations in an unsupported way?

awhawks
awhawks's picture
Joined on 2011-04-06
User Post #1
#2
2011-04-22 10:40

Your code demonstrates an ObjectDB bug in handling multiple order expressions in inverse (mapped by) fields.

Version 2.2.2 includes a fix - please try it.

Thank you for your report.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #206
#3
2011-04-22 17:33

2.2.2 fixed the problem

awhawks
awhawks's picture
Joined on 2011-04-06
User Post #2

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel