本文整理汇总了Java中javax.persistence.PreRemove类的典型用法代码示例。如果您正苦于以下问题:Java PreRemove类的具体用法?Java PreRemove怎么用?Java PreRemove使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PreRemove类属于javax.persistence包,在下文中一共展示了PreRemove类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
/**
* 删除前处理
*/
@PreRemove
public void preRemove() {
Set<Promotion> promotions = getPromotions();
if (promotions != null) {
for (Promotion promotion : promotions) {
promotion.getCoupons().remove(this);
}
}
List<Order> orders = getOrders();
if (orders != null) {
for (Order order : orders) {
order.getCoupons().remove(this);
}
}
}
示例2: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
/**
* 删除前处理
*/
@PreRemove
public void preRemove() {
Set<PaymentMethod> paymentMethods = getPaymentMethods();
if (paymentMethods != null) {
for (PaymentMethod paymentMethod : paymentMethods) {
paymentMethod.getShippingMethods().remove(this);
}
}
Set<Order> orders = getOrders();
if (orders != null) {
for (Order order : orders) {
order.setShippingMethod(null);
}
}
}
示例3: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
/**
* 删除前处理
*/
@PreRemove
public void preRemove() {
Set<Article> articles = getArticles();
if (articles != null) {
for (Article article : articles) {
article.getTags().remove(this);
}
}
Set<Product> products = getProducts();
if (products != null) {
for (Product product : products) {
product.getTags().remove(this);
}
}
}
示例4: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
/**
* 删除前处理
*/
@PreRemove
public void preRemove() {
Set<Member> favoriteMembers = getFavoriteMembers();
if (favoriteMembers != null) {
for (Member favoriteMember : favoriteMembers) {
favoriteMember.getFavoriteProducts().remove(this);
}
}
Set<Promotion> promotions = getPromotions();
if (promotions != null) {
for (Promotion promotion : promotions) {
promotion.getProducts().remove(this);
}
}
Set<OrderItem> orderItems = getOrderItems();
if (orderItems != null) {
for (OrderItem orderItem : orderItems) {
orderItem.setProduct(null);
}
}
}
示例5: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
/**
* 删除前处理
*/
@PreRemove
public void preRemove() {
Set<Product> products = getProducts();
if (products != null) {
for (Product product : products) {
product.setBrand(null);
}
}
Set<ProductCategory> productCategories = getProductCategories();
if (productCategories != null) {
for (ProductCategory productCategory : productCategories) {
productCategory.getBrands().remove(this);
}
}
Set<Promotion> promotions = getPromotions();
if (promotions != null) {
for (Promotion promotion : promotions) {
promotion.getBrands().remove(this);
}
}
}
示例6: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
@PreRemove
public void preRemove() {
if (getCertificates() != null) {
// Dates are converted to UTC before saving into the DB
Calendar cal = Calendar.getInstance();
long offset = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET);
Date now = new Date(cal.getTimeInMillis() - offset);
for (Certificate cert : getCertificates()) {
// Revoke certificates
cert.setRevokedAt(now);
cert.setRevokeReason("cessationofoperation");
cert.setRevoked(true);
// Detach certificate from entity - since the model type isn't known, just blank all.
cert.setOrganization(null);
cert.setDevice(null);
cert.setService(null);
cert.setUser(null);
cert.setVessel(null);
}
}
}
示例7: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
/**
* 删除前处理
*/
@PreRemove
public void preRemove() {
// Set<User> favoriteUsers = getFavoriteUsers();
// if (favoriteUsers != null) {
// for (User favoriteMember : favoriteUsers) {
// favoriteMember.getFavoriteProducts().remove(this);
// }
// }
Set<Promotion> promotions = getPromotions();
if (promotions != null) {
for (Promotion promotion : promotions) {
promotion.getProducts().remove(this);
}
}
Set<OrderItem> orderItems = getOrderItems();
if (orderItems != null) {
for (OrderItem orderItem : orderItems) {
orderItem.setProduct(null);
}
}
}
示例8: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
@PreRemove
public void preRemove() {
for (TmContactEasy arg0 : getTmContactEasies()) {
arg0.setReqServHotel(null);
}
docDocumentsByDocumentForUserId = null;
docDocumentsByDocumentForHotelId = null;
paymentPrice = null;
paymentTariff = null;
servHotel = null;
servHotelRoom = null;
usersByRequestUserId = null;
usersByResponseUserId = null;
}
示例9: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
@PreRemove
public void preRemove() {
for (ServTransferRoute arg0 : getServTransferRoutes()) {
arg0.setServTransfer(null);
}
currCurrency = null;
dictGlobalByPaymentTypeId = null;
dictGlobalByTypeTransferId = null;
dictGlobalByTransportId = null;
locationCities = null;
locationCountries = null;
tmAccount = null;
}
示例10: processDefaultJpaCallbacks
import javax.persistence.PreRemove; //导入依赖的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 ) );
}
}
示例11: processJpaCallbacks
import javax.persistence.PreRemove; //导入依赖的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 ) );
}
}
示例12: onPreRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
@PreRemove
void onPreRemove(Object o) {
String txId = (String)ThreadLocalContext.get(CompositeTransactionParticipantService.CURRENT_TRANSACTION_KEY);
if (null == txId){
LOG.info("onPreRemove outside any transaction");
} else {
LOG.info("onPreRemove inside transaction [{}]", txId);
enlist(o, EntityCommand.Action.DELETE, txId);
}
}
示例13: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
/**
* 删除前处理
*/
@PreRemove
public void preRemove() {
if (getDeposit() != null) {
getDeposit().setPayment(null);
}
}
示例14: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
/**
* 删除前处理
*/
@PreRemove
public void preRemove() {
Set<Deposit> deposits = getDeposits();
if (deposits != null) {
for (Deposit deposit : deposits) {
deposit.setOrder(null);
}
}
}
示例15: preRemove
import javax.persistence.PreRemove; //导入依赖的package包/类
/**
* 删除前处理
*/
@PreRemove
public void preRemove() {
Set<Promotion> promotions = getPromotions();
if (promotions != null) {
for (Promotion promotion : promotions) {
promotion.getProductCategories().remove(this);
}
}
}