本文整理匯總了Java中org.hibernate.search.event.impl.FullTextIndexEventListener類的典型用法代碼示例。如果您正苦於以下問題:Java FullTextIndexEventListener類的具體用法?Java FullTextIndexEventListener怎麽用?Java FullTextIndexEventListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FullTextIndexEventListener類屬於org.hibernate.search.event.impl包,在下文中一共展示了FullTextIndexEventListener類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: integrate
import org.hibernate.search.event.impl.FullTextIndexEventListener; //導入依賴的package包/類
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
EventListenerRegistry service = serviceRegistry.getService(org.hibernate.event.service.spi.EventListenerRegistry.class);
StandardPBEStringEncryptor encrypt = new StandardPBEStringEncryptor();
encrypt.setPassword("test_password");
RenderedMessageEncryptEventListener encryptListener = new RenderedMessageEncryptEventListener();
encryptListener.setStringEncryptor(encrypt);
RenderedMessageDecryptEventListener decryptListener = new RenderedMessageDecryptEventListener();
decryptListener.setStringEncryptor(encrypt);
FullTextIndexEventListener fullTextListener = new FullTextIndexEventListener();
service.appendListeners(EventType.PRE_UPDATE, encryptListener);
service.prependListeners(EventType.POST_UPDATE, decryptListener);
service.appendListeners(EventType.PRE_INSERT, encryptListener);
service.prependListeners(EventType.POST_INSERT, decryptListener);
service.appendListeners(EventType.POST_LOAD, decryptListener);
}
示例2: registerFullTextIndexEventListener
import org.hibernate.search.event.impl.FullTextIndexEventListener; //導入依賴的package包/類
/**
* Hibernate-Search의 FullTextIndexEventListener를 SessionFactory에 등록합니다.
*
* @param sessionFactory the session factory
* @param listener the listener
*/
public static void registerFullTextIndexEventListener(SessionFactory sessionFactory, FullTextIndexEventListener listener) {
assert sessionFactory != null;
log.info("sessionFactory에 FullTestIndexEventListener를 등록합니다... listener=[{}]", listener);
try {
HibernateTool.registerEventListener(sessionFactory, listener,
EventType.POST_UPDATE,
EventType.POST_INSERT,
EventType.POST_DELETE,
EventType.FLUSH);
} catch (Throwable t) {
log.warn("listener를 등록하는데 실패했습니다. 단 이미 등록된 경우에는 무시해도 됩니다.", t);
}
}