@LookupDisplay
The current implementation of display "labels" in GGCE that are used in the Curator Tool lookup tables allows for @LookupDisplay
to be defined on a field and on a method. When defined on a field we are able to make a very fast query to the database and only select the id + field
, but when defined on a method, we need to fetch entire objects to generate a simple string. The lookupDisplay()
method generally just concatenates a few fields. Using lookupDisplay
method is a performance issue in large GGCE databases.
In this ticket we allow @LookupDisplay
to be defined on a class as a JPA expression:
@LookupDisplay("{JPA expresion}")
public class ...
We remove the option to define @LookupDisplay
on a method (and remove handling methods in VirutalLookupServiceImpl
).
When LookupDisplay
is not declared we already use the id
field as a label.
Instead of fetching entire objects to memory, we let the database do the string generation. This approach comes with some limitations, but it eliminates a big bottleneck that may even cause the server to OOM.
Example
For Cooperator
to generate the label Last, First, My Organization
we can use:
@LookupDisplay("concat(lastName, ', ', firstName, ', ', coalesce(organization, ''))")
public class Cooperator extends ... {