Here are the examples of the java api org.hibernate.CacheMode.IGNORE taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
18
Source : StatelessSessionImpl.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
@Override
public CacheMode getCacheMode() {
return CacheMode.IGNORE;
}
14
Source : QueryBinder.java
with GNU General Public License v2.0
from lamsfoundation
with GNU General Public License v2.0
from lamsfoundation
private static CacheMode getCacheMode(CacheModeType cacheModeType) {
switch(cacheModeType) {
case GET:
return CacheMode.GET;
case IGNORE:
return CacheMode.IGNORE;
case NORMAL:
return CacheMode.NORMAL;
case PUT:
return CacheMode.PUT;
case REFRESH:
return CacheMode.REFRESH;
default:
throw new replacedertionFailure("Unknown cacheModeType: " + cacheModeType);
}
}
1
Source : HibernateContextDAO.java
with Apache License 2.0
from isstac
with Apache License 2.0
from isstac
@Override
@Transactional
public void updateSearchIndexForType(Clreplaced<?> type) {
// From http://docs.jboss.org/hibernate/search/3.3/reference/en-US/html/manual-index-changes.html#search-batchindex-flushtoindexes
FullTextSession session = Search.getFullTextSession(sessionFactory.getCurrentSession());
session.purgeAll(type);
// Prepare session for batch work
session.flush();
session.clear();
FlushMode flushMode = session.getFlushMode();
CacheMode cacheMode = session.getCacheMode();
try {
session.setFlushMode(FlushMode.MANUAL);
session.setCacheMode(CacheMode.IGNORE);
// Scrollable results will avoid loading too many objects in memory
ScrollableResults results = session.createCriteria(type).setFetchSize(1000).scroll(ScrollMode.FORWARD_ONLY);
int index = 0;
while (results.next()) {
index++;
// index each element
session.index(results.get(0));
if (index % 1000 == 0) {
// apply changes to indexes
session.flushToIndexes();
// free memory since the queue is processed
session.clear();
}
}
session.flushToIndexes();
session.clear();
} finally {
session.setFlushMode(flushMode);
session.setCacheMode(cacheMode);
}
}