bedouinos
bedouinos

Reputation: 21

jhipster does not cache the results of query

I noticed that cache memory does not work. if you set

    <logger name="org.hibernate" level="WARN" />
    <logger name="org.hibernate.type" level="TRACE" />
    <logger name="org.hibernate.SQL" level="DEBUG" />
    <logger name="org.hibernate.stat" level="DEBUG"/>

I have an entity of City which does not change regularly and the time to execute the query is almost 500 ms. What am i doing wrong. Also i set the entity of City to ehcache.xml

enter image description here

Upvotes: 0

Views: 374

Answers (1)

bedouinos
bedouinos

Reputation: 21

I am not sure but i believe that i fixed the problem. Into the implementation of service you have to add one line

@Override
**@Cacheable( "com.ppc.ptol2.domain.City" )**
@Transactional( readOnly = true )
public List<City> findAll() {
    log.debug("Request to get all City");
    return cityRepository.findAll();
}

Upvotes: 1

Related Questions