@Select("select id, firstname, lastname from person") @Options(flushCache = FlushCachePolicy.TRUE) List<Person> findWithFlushCache();
@Insert("insert into person (id, firstname, lastname) values (#{id}, #{firstname}, #{lastname})") @Options(flushCache = FlushCachePolicy.FALSE) public void createWithoutFlushCache(Person person);
@Select("select id, firstname, lastname from person") @Options(flushCache = FlushCachePolicy.TRUE) public List<Person> findWithFlushCache();
@Select("select * from deal where id = #{id}") @Options(flushCache=FlushCachePolicy.DEFAULT) Deal findById(@Param("id") Long id);
@Select("select * from deal") @Options(flushCache=FlushCachePolicy.DEFAULT) List<Deal> findAll();
@Insert("INSERT into DEAL(id, name, startDate, version, creationTime) VALUES(#{id}, #{name}, #{startDate}, 0, CURRENT_TIMESTAMP)") @SelectKey(statement="SELECT DEAL_SEQUENCE.NEXTVAL FROM DUAL", keyProperty="id", before=true, resultType=Long.class) @Options(flushCache=FlushCachePolicy.DEFAULT) Long insert(Deal deal);
@Update("UPDATE DEAL SET name=#{name}, startDate=#{startDate}, version=version+1, lastUpdateTime=CURRENT_TIMESTAMP WHERE id =#{id} and version=#{version}") @Options(flushCache=FlushCachePolicy.DEFAULT) int update(Deal deal);