* @param realStatement
*/
public CachedStatement(CacheProvider cacheProvider, Statement realStatement) {
this.realStatement = realStatement;
this.cacheProvider = cacheProvider;
StatementMetaData metaData = realStatement.getMetaData();
SQLType sqlType = metaData.getSQLType();
cacheDeleteAnnotation = metaData.getMethod().getAnnotation(CacheDelete.class);
Cache cacheAnnotation = metaData.getMethod().getAnnotation(Cache.class);
if (sqlType == SQLType.READ) {
this.cacheAnnotation = cacheAnnotation;
} else {
this.cacheAnnotation = null;
if (cacheAnnotation != null) {
Log logger = LogFactory.getLog(CachedStatement.class);
logger.warn("@" + Cache.class.getName() + " is invalid for a " //
+ sqlType + " SQL:" + metaData.getSQL());
}
}
}