I have the following Mapped entity:
@Table(uniqueConstraints = @UniqueConstraint(columnNames = { "eKey-field-1", "eKey-field-2", "eKey-field-3" }))
class EntityMapped {
@Id
@GeneratedValue...
Long Id;
@Embedded
EntityKeyMapped eKey;
There are no updates and no deletes. New records are added if there is no security for the given eKey.
The select queries are very simple, but up to 1+ Mln queries executed in parallel per day (+sometimes new records are added). So I think to cache it somehow.
Within the Dao I see something like:
return (EntityMapped) getSession().createCriteria(EntityMapped.class).add(Example.create(example)).uniqueResult();
I am thinking of the best way to cache this requests. Atm I consider :
return (EntityMapped) getSession().createCriteria(EntityMapped.class).add(Example.create(example)).setCacheable(true).uniqueResult();
But maybe for this case there is a better (easier) way to cache?