当前位置: 首页>>代码示例>>Java>>正文


Java PostRemove类代码示例

本文整理汇总了Java中javax.persistence.PostRemove的典型用法代码示例。如果您正苦于以下问题:Java PostRemove类的具体用法?Java PostRemove怎么用?Java PostRemove使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PostRemove类属于javax.persistence包,在下文中一共展示了PostRemove类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: nullifyKey

import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
public void nullifyKey(Object object) {

    /*
     * We use reflection to locate the setId method since it's not defined in
     * any of the base interfaces of the VARS JPAEntities. This is deliberate
     * we don't normally want developers playing with the setId method.
     */
    if (object instanceof JPAEntity) {
        Class params[] = {Long.class};
        Object args[] = {null};
        try {
            Method method = object.getClass().getDeclaredMethod("setId", params);
            method.invoke(object, args);
        }
        catch (Exception e) {
            log.error("Failed to set primary key on " + object + " to null", e);
        }
    }
}
 
开发者ID:hohonuuli,项目名称:vars,代码行数:21,代码来源:KeyNullifier.java

示例2: removeImagesFromDisk

import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
public void removeImagesFromDisk(ImageResource image){
	
	if (image.getHiResImagePath() != null){
		delete(image.getHiResImagePath());
	}
	
	if (image.getLoResImagePath() != null){
		delete(image.getLoResImagePath());
	}
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:12,代码来源:ImageResourceListener.java

示例3: clearCaches

import javax.persistence.PostRemove; //导入依赖的package包/类
/**
 * Clear products and orders from cache post remove.
 */
@PostRemove
private void clearCaches() {
	CacheManager.MANAGER.clearCache(PersistenceProduct.class);
	CacheManager.MANAGER.clearCache(PersistenceOrder.class);
	CacheManager.MANAGER.clearRemoteCache(PersistenceOrderItem.class);
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:10,代码来源:PersistenceOrderItem.java

示例4: clearCaches

import javax.persistence.PostRemove; //导入依赖的package包/类
/**
 * Clear users and order items from cache post remove.
 */
@PostRemove
private void clearCaches() {
	CacheManager.MANAGER.clearCache(PersistenceUser.class);
	CacheManager.MANAGER.clearCache(PersistenceOrderItem.class);
	CacheManager.MANAGER.clearRemoteCache(PersistenceOrder.class);
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:10,代码来源:PersistenceOrder.java

示例5: processDefaultJpaCallbacks

import javax.persistence.PostRemove; //导入依赖的package包/类
private void processDefaultJpaCallbacks(String instanceCallbackClassName, List<JpaCallbackClass> jpaCallbackClassList) {
	ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName );

	// Process superclass first if available and not excluded
	if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) {
		DotName superName = callbackClassInfo.superName();
		if ( superName != null ) {
			processDefaultJpaCallbacks( instanceCallbackClassName, jpaCallbackClassList );
		}
	}

	String callbackClassName = callbackClassInfo.name().toString();
	Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>();
	createDefaultCallback(
			PrePersist.class, PseudoJpaDotNames.DEFAULT_PRE_PERSIST, callbackClassName, callbacksByType
	);
	createDefaultCallback(
			PreRemove.class, PseudoJpaDotNames.DEFAULT_PRE_REMOVE, callbackClassName, callbacksByType
	);
	createDefaultCallback(
			PreUpdate.class, PseudoJpaDotNames.DEFAULT_PRE_UPDATE, callbackClassName, callbacksByType
	);
	createDefaultCallback(
			PostLoad.class, PseudoJpaDotNames.DEFAULT_POST_LOAD, callbackClassName, callbacksByType
	);
	createDefaultCallback(
			PostPersist.class, PseudoJpaDotNames.DEFAULT_POST_PERSIST, callbackClassName, callbacksByType
	);
	createDefaultCallback(
			PostRemove.class, PseudoJpaDotNames.DEFAULT_POST_REMOVE, callbackClassName, callbacksByType
	);
	createDefaultCallback(
			PostUpdate.class, PseudoJpaDotNames.DEFAULT_POST_UPDATE, callbackClassName, callbacksByType
	);
	if ( !callbacksByType.isEmpty() ) {
		jpaCallbackClassList.add( new JpaCallbackClassImpl( instanceCallbackClassName, callbacksByType, true ) );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:EntityClass.java

示例6: processJpaCallbacks

import javax.persistence.PostRemove; //导入依赖的package包/类
private void processJpaCallbacks(String instanceCallbackClassName, boolean isListener, List<JpaCallbackClass> callbackClassList) {

		ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName );

		// Process superclass first if available and not excluded
		if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) {
			DotName superName = callbackClassInfo.superName();
			if ( superName != null ) {
				processJpaCallbacks(
						instanceCallbackClassName,
						isListener,
						callbackClassList
				);
			}
		}

		Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>();
		createCallback( PrePersist.class, JPADotNames.PRE_PERSIST, callbacksByType, callbackClassInfo, isListener );
		createCallback( PreRemove.class, JPADotNames.PRE_REMOVE, callbacksByType, callbackClassInfo, isListener );
		createCallback( PreUpdate.class, JPADotNames.PRE_UPDATE, callbacksByType, callbackClassInfo, isListener );
		createCallback( PostLoad.class, JPADotNames.POST_LOAD, callbacksByType, callbackClassInfo, isListener );
		createCallback( PostPersist.class, JPADotNames.POST_PERSIST, callbacksByType, callbackClassInfo, isListener );
		createCallback( PostRemove.class, JPADotNames.POST_REMOVE, callbacksByType, callbackClassInfo, isListener );
		createCallback( PostUpdate.class, JPADotNames.POST_UPDATE, callbacksByType, callbackClassInfo, isListener );
		if ( !callbacksByType.isEmpty() ) {
			callbackClassList.add( new JpaCallbackClassImpl( instanceCallbackClassName, callbacksByType, isListener ) );
		}
	}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:EntityClass.java

示例7: postRemoveLifecycleMethod

import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
public void postRemoveLifecycleMethod() {
    postRemoveCount++;
    if (postRemoveCount != preRemoveCount) {
        throw new IllegalStateException("postRemoveCount(" + postRemoveCount + ") != preRemoveCount(" + preRemoveCount + ")");
    }
}
 
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:8,代码来源:FieldAccessAnnotationTestBean.java

示例8: testRemove

import javax.persistence.PostRemove; //导入依赖的package包/类
@Test
public void testRemove() throws Exception {
	User user = new User();
	user.name = "Michael";
	user.email = "[email protected]";
	warpdb.save(user);
	warpdb.remove(user);
	assertTrue(user.callbacks.contains(PreRemove.class));
	assertTrue(user.callbacks.contains(PostRemove.class));
	assertNull(warpdb.fetch(User.class, user.id));
}
 
开发者ID:michaelliao,项目名称:warpdb,代码行数:12,代码来源:WarpDbCRUDAndCallbackTest.java

示例9: postRemove

import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
public void postRemove(E entity) {
    T delegate = getDelegate();
    if (delegate != null) {
        delegate.postRemove(entity);
    }
}
 
开发者ID:noveogroup,项目名称:clap,代码行数:8,代码来源:BaseEntityListener.java

示例10: clearCaches

import javax.persistence.PostRemove; //导入依赖的package包/类
/**
 * Clear categories and order items from cache post remove.
 */
@PostRemove
private void clearCaches() {
	CacheManager.MANAGER.clearCache(PersistenceCategory.class);
	CacheManager.MANAGER.clearRemoteCache(PersistenceProduct.class);
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:9,代码来源:PersistenceProduct.java

示例11: clearCaches

import javax.persistence.PostRemove; //导入依赖的package包/类
/**
 * Clear users and order items from cache post remove.
 */
@PostRemove
private void clearCaches() {
	CacheManager.MANAGER.clearCache(PersistenceOrder.class);
	CacheManager.MANAGER.clearRemoteCache(PersistenceUser.class);
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:9,代码来源:PersistenceUser.java

示例12: clearCaches

import javax.persistence.PostRemove; //导入依赖的package包/类
/**
 * Clear products from cache to update relationships.
 */
@PostRemove
private void clearCaches() {
	CacheManager.MANAGER.clearCache(PersistenceProduct.class);
	CacheManager.MANAGER.clearRemoteCache(PersistenceCategory.class);
}
 
开发者ID:DescartesResearch,项目名称:Pet-Supply-Store,代码行数:9,代码来源:PersistenceCategory.java

示例13: postRemove

import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
public void postRemove(Object entity) {
	notifyEntityPushers(EntityAction.REMOVED, entity);
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:5,代码来源:EntityPushEntityListener.java

示例14: postRemove

import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
public void postRemove(Object object) {
    LOG.info("Listening to post remove for object:" + object);
}
 
开发者ID:jfillo,项目名称:spring-data-rest-webhook,代码行数:5,代码来源:WebhookEntityListener.java

示例15: postRemove

import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
private void postRemove(Object object) {
	logger.debug("### DebugListener.postRemove({})", object);
}
 
开发者ID:Daniel-Dos,项目名称:DanielDias-MongoDB,代码行数:5,代码来源:JPADebugListener.java


注:本文中的javax.persistence.PostRemove类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。