本文整理汇总了Java中org.hibernate.event.spi.PostDeleteEventListener类的典型用法代码示例。如果您正苦于以下问题:Java PostDeleteEventListener类的具体用法?Java PostDeleteEventListener怎么用?Java PostDeleteEventListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PostDeleteEventListener类属于org.hibernate.event.spi包,在下文中一共展示了PostDeleteEventListener类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: postDelete
import org.hibernate.event.spi.PostDeleteEventListener; //导入依赖的package包/类
private void postDelete() {
final EventListenerGroup<PostDeleteEventListener> listenerGroup = listenerGroup( EventType.POST_DELETE );
if ( listenerGroup.isEmpty() ) {
return;
}
final PostDeleteEvent event = new PostDeleteEvent(
getInstance(),
getId(),
state,
getPersister(),
eventSource()
);
for ( PostDeleteEventListener listener : listenerGroup.listeners() ) {
listener.onPostDelete( event );
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:EntityDeleteAction.java
示例2: registerListeners
import org.hibernate.event.spi.PostDeleteEventListener; //导入依赖的package包/类
@PostConstruct
public void registerListeners() {
// TODO: This method of getting a reference to the SessionFactory (and thereforce the ServiceRegistry) is Deprecated. Find out the right Hibernate 5.2 way to do this.
EventListenerRegistry registry = entityManagerFactory.getSessionFactory().getServiceRegistry().getService(EventListenerRegistry.class);
if (preInsertEventListeners != null) {
registry.appendListeners(EventType.PRE_INSERT, preInsertEventListeners.toArray(new PreInsertEventListener[preInsertEventListeners.size()]));
}
if (postInsertEventListeners != null) {
registry.appendListeners(EventType.POST_INSERT, postInsertEventListeners.toArray(new PostInsertEventListener[postInsertEventListeners.size()]));
}
if (preUpdateEventListeners != null) {
registry.appendListeners(EventType.PRE_UPDATE, preUpdateEventListeners.toArray(new PreUpdateEventListener[preUpdateEventListeners.size()]));
}
if (postUpdateEventListeners != null) {
registry.appendListeners(EventType.POST_UPDATE, postUpdateEventListeners.toArray(new PostUpdateEventListener[postUpdateEventListeners.size()]));
}
if (preDeleteEventListeners != null) {
registry.appendListeners(EventType.PRE_DELETE, preDeleteEventListeners.toArray(new PreDeleteEventListener[preDeleteEventListeners.size()]));
}
if (postDeleteEventListeners != null) {
registry.appendListeners(EventType.POST_DELETE, postDeleteEventListeners.toArray(new PostDeleteEventListener[postDeleteEventListeners.size()]));
}
}
开发者ID:jfillo,项目名称:spring-data-rest-webhook,代码行数:24,代码来源:EventListenerRegistryAdapter.java
示例3: postCommitDelete
import org.hibernate.event.spi.PostDeleteEventListener; //导入依赖的package包/类
private void postCommitDelete(boolean success) {
final EventListenerGroup<PostDeleteEventListener> listenerGroup = listenerGroup( EventType.POST_COMMIT_DELETE );
if ( listenerGroup.isEmpty() ) {
return;
}
final PostDeleteEvent event = new PostDeleteEvent(
getInstance(),
getId(),
state,
getPersister(),
eventSource()
);
for ( PostDeleteEventListener listener : listenerGroup.listeners() ) {
if ( PostCommitDeleteEventListener.class.isInstance( listener ) ) {
if ( success ) {
listener.onPostDelete( event );
}
else {
((PostCommitDeleteEventListener) listener).onPostDeleteCommitFailed( event );
}
}
else {
//default to the legacy implementation that always fires the event
listener.onPostDelete( event );
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:EntityDeleteAction.java
示例4: hasPostCommitEventListeners
import org.hibernate.event.spi.PostDeleteEventListener; //导入依赖的package包/类
@Override
protected boolean hasPostCommitEventListeners() {
final EventListenerGroup<PostDeleteEventListener> group = listenerGroup( EventType.POST_COMMIT_DELETE );
for ( PostDeleteEventListener listener : group.listeners() ) {
if ( listener.requiresPostCommitHanding( getPersister() ) ) {
return true;
}
}
return false;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:EntityDeleteAction.java
示例5: configure
import org.hibernate.event.spi.PostDeleteEventListener; //导入依赖的package包/类
@Override
protected void configure() {
bind(TestEventListener.class)
.to(PostDeleteEventListener.class)
.to(PreDeleteEventListener.class)
.to(PreInsertEventListener.class)
.to(PostInsertEventListener.class)
.to(PreUpdateEventListener.class)
.to(PostUpdateEventListener.class)
.to(PostCommitInsertEventListener.class)
.to(PostCommitUpdateEventListener.class)
.to(PostCommitDeleteEventListener.class)
.in(PerThread.class);
}
开发者ID:krotscheck,项目名称:jersey2-toolkit,代码行数:15,代码来源:HibernateSessionFactoryFactoryTest.java
示例6: testEventInjection
import org.hibernate.event.spi.PostDeleteEventListener; //导入依赖的package包/类
/**
* Test the application event injectors.
*/
@Test
public void testEventInjection() {
// Create a fake application.
SessionFactory factoryFactory = locator
.getService(SessionFactory.class);
Assert.assertNotNull(factoryFactory);
ServiceRegistry serviceRegistry = ((SessionFactoryImpl) factoryFactory)
.getServiceRegistry();
EventListenerRegistry eventRegistry = serviceRegistry
.getService(EventListenerRegistry.class);
EventListenerGroup<PreInsertEventListener> priGroup = eventRegistry
.getEventListenerGroup(EventType.PRE_INSERT);
assertContainsListener(priGroup);
EventListenerGroup<PostInsertEventListener> poiGroup = eventRegistry
.getEventListenerGroup(EventType.POST_INSERT);
assertContainsListener(poiGroup);
EventListenerGroup<PreUpdateEventListener> pruGroup = eventRegistry
.getEventListenerGroup(EventType.PRE_UPDATE);
assertContainsListener(pruGroup);
EventListenerGroup<PostUpdateEventListener> pouGroup = eventRegistry
.getEventListenerGroup(EventType.POST_UPDATE);
assertContainsListener(pouGroup);
EventListenerGroup<PreDeleteEventListener> prdGroup = eventRegistry
.getEventListenerGroup(EventType.PRE_DELETE);
assertContainsListener(prdGroup);
EventListenerGroup<PostDeleteEventListener> podGroup = eventRegistry
.getEventListenerGroup(EventType.POST_DELETE);
assertContainsListener(podGroup);
EventListenerGroup<PostInsertEventListener> pciGroup = eventRegistry
.getEventListenerGroup(EventType.POST_COMMIT_INSERT);
assertContainsListener(pciGroup);
EventListenerGroup<PostUpdateEventListener> pcuGroup = eventRegistry
.getEventListenerGroup(EventType.POST_COMMIT_UPDATE);
assertContainsListener(pcuGroup);
EventListenerGroup<PostDeleteEventListener> pcdGroup = eventRegistry
.getEventListenerGroup(EventType.POST_COMMIT_DELETE);
assertContainsListener(pcdGroup);
}
开发者ID:krotscheck,项目名称:jersey2-toolkit,代码行数:54,代码来源:HibernateSessionFactoryFactoryTest.java
注:本文中的org.hibernate.event.spi.PostDeleteEventListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论