本文整理汇总了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);
}
}
}
示例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());
}
}
示例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);
}
示例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);
}
示例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 ) );
}
}
示例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 ) );
}
}
示例7: postRemoveLifecycleMethod
import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
public void postRemoveLifecycleMethod() {
postRemoveCount++;
if (postRemoveCount != preRemoveCount) {
throw new IllegalStateException("postRemoveCount(" + postRemoveCount + ") != preRemoveCount(" + preRemoveCount + ")");
}
}
示例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));
}
示例9: postRemove
import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
public void postRemove(E entity) {
T delegate = getDelegate();
if (delegate != null) {
delegate.postRemove(entity);
}
}
示例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);
}
示例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);
}
示例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);
}
示例13: postRemove
import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
public void postRemove(Object entity) {
notifyEntityPushers(EntityAction.REMOVED, entity);
}
示例14: postRemove
import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
public void postRemove(Object object) {
LOG.info("Listening to post remove for object:" + object);
}
示例15: postRemove
import javax.persistence.PostRemove; //导入依赖的package包/类
@PostRemove
private void postRemove(Object object) {
logger.debug("### DebugListener.postRemove({})", object);
}