Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1672 closed enhancement (fixed)

Join annotation values into a main item query

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: major Milestone: BASE 3.2
Component: core Version:
Keywords: Cc:

Description (last modified by Nicklas Nordborg)

By mapping a few extra associations in the data layer classes it should be possible to join the annotation value tables into the main item query. The main use case is that it would be possible to sort on single-valued annotation values in the web interface (see #1673).

Change History (5)

comment:1 by Nicklas Nordborg, 13 years ago

Description: modified (diff)

comment:2 by Nicklas Nordborg, 13 years ago

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:3 by Nicklas Nordborg, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [6022]) Fixes #1672: Join annotation values into a main item query

There is now support for this in the Query API. The main entry point is the Annotations.expression(), Annotations.innerJoin() and Annotations.leftJoin() methods. The implementation is in the AnnotationJoin and AnnotationExpression classes. The expression variant uses an auto-joiner to automatically create the correct join. Otherwise, an explict join can be use together with a regular Hql.alias() expression.

In the data layer, the functionality is provided by the shortcut link defined by AnnotatableData.getAnnotations(). The AnnotationLink provides the mappings that are needed to reach the final ***Values table. To get XDoclet to create the mapping that we needed we have added support for property-ref and mutable.

comment:4 by Nicklas Nordborg, 13 years ago

(In [6045]) Belong to #1674 (not 1672).

Last edited 13 years ago by Nicklas Nordborg (previous) (diff)

comment:5 by Nicklas Nordborg, 12 years ago

(In [6106]) References #1672: Join annotation values into a main item query

Fixes an issued with MySQL that didn't create the 'id' column as AUTO_INCREMENT.

Note: See TracTickets for help on using tickets.