Enable cache for entities

The decision whether an entity should be cached or not can be set directly in the entity in Settings → Cacheable. Simply select "true" or "false".

*Choose Entity Cache Strategy

In certain cases it may be necessary to influence the caching strategy. This is possible via annotation in the code editor.

  1. Switch to the code area by pressing "\{}Java".

  2. Insert an empty line after the last annotation +. Image not found

  3. Now use the code template "Entity Cache Strategy" from the palette to insert the desired code line

  4. Now just select the desired strategy via the enum at the end of the statement
    Image not found

*Cache Strategies

Name

Function

Default

NONSTRICT_READ_WRITE

The cache is updated after a transaction has changed an affected record. Strong consistency is not guaranteed in this strategy because there is a small window of time until the data is updated. This type of strategy is suitable for use cases that can tolerate possible consistency.

NO

READ_ONLY

Used only for entities which are NEVER changed. So it is very suitable for static reference values in the database

NO

READ_WRITE

This strategy guarantees strong consistency achieved by using "soft" locks: When a cached entity is updated, a soft lock is also stored in the cache for that entity, which is released after the transaction is committed. All concurrent transactions that access soft-locked entries fetch the corresponding data directly from the database

YES

TRANSACTIONAL

Cache changes are made in distributed XA transactions. A change in a cached entity is committed or rolled back in the same XA transaction either in the database or in the cache

NO