LookUpField data fetch limitiation

Hi,

I’m using LookUpField in a <fieldGroup> with optionsDatasource, and it fetches the data correctly… however the limit is up to 10000 (top 10000). How can I force to retrieve all data?

I need to lookup into an entity which retrieves more than 100000 rows. Do you have any best practices for using LookUpField on this kind of situations (with a lot of data), with examples ?

Thanks!
Gent

Hi, @halili.gent!

We don’t recommend to increase the maximum number of entity instances that can be shown in the LookupField. Instead, use the SuggestionField.

However, if you still want to increase the limit, take a look at the docs and maxFetchUI.

1 Like

Hi @gorelov,

I totally want to avoid the limit increase as you suggest, instead I will use the Suggestion Field.

Can I implement SuggestionField inside my fieldGroup ? or I must use generator= to do it inside the java code ?

You can define custom field either in the XML (see docs) or in Java controller (see docs).

I configured and it’s searching, the popup list is showed but when I select one result and save the entity, it says that the propriety is null.
Do you know what am I doing wrong ?

<field property="mainPoint">
          <suggestionField id="suggestionField" property="mainPoint">
                        <query entityClass="com.company.points.ZPoint"
                               escapeValueForLike="true"
                               view="_local"
                               searchStringFormat="%$searchString%">
                            select e from rbd$ZPoint e where e.pointVal like :searchString
                        </query>
          </suggestionField>
</field>

The field is declared in the other Entity :

    @Lookup(type = LookupType.DROPDOWN)
    @OnDelete(DeletePolicy.DENY)
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "MAIN_BUA_ID")
    @NotNull
    protected ZPoint mainPoint;

Try to set the datasource attribute value. Since the field is custom, you have to define the datasource and the property attributes manually.

1 Like

Thanks for the solution!

Have an other question: Is there anyway to allow the user to add new value if there is nothing(same as lookup)?