本文整理汇总了Java中org.hibernate.event.spi.PreUpdateEvent类的典型用法代码示例。如果您正苦于以下问题:Java PreUpdateEvent类的具体用法?Java PreUpdateEvent怎么用?Java PreUpdateEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PreUpdateEvent类属于org.hibernate.event.spi包,在下文中一共展示了PreUpdateEvent类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preUpdate
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
private boolean preUpdate() {
boolean veto = false;
final EventListenerGroup<PreUpdateEventListener> listenerGroup = listenerGroup( EventType.PRE_UPDATE );
if ( listenerGroup.isEmpty() ) {
return veto;
}
final PreUpdateEvent event = new PreUpdateEvent(
getInstance(),
getId(),
state,
previousState,
getPersister(),
eventSource()
);
for ( PreUpdateEventListener listener : listenerGroup.listeners() ) {
veto |= listener.onPreUpdate( event );
}
return veto;
}
示例2: onPreUpdate
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
public boolean onPreUpdate(PreUpdateEvent event) {
validate(
event.getEntity(), event.getPersister().getEntityMode(), event.getPersister(),
event.getSession().getFactory(), GroupsPerOperation.Operation.UPDATE
);
return false;
}
示例3: buildUpdateMessage
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
private String buildUpdateMessage(PreUpdateEvent event) {
String[] propertyNames = event.getPersister().getEntityMetamodel().getPropertyNames();
Object[] oldStates = event.getOldState();
Object[] newStates = event.getState();
int index = 0;
StringBuilder message = new StringBuilder(128);
for (String propertyName : propertyNames) {
message.append(message(propertyName, oldStates[index], newStates[index]));
index++;
}
return message.toString();
}
示例4: onPreUpdate
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
@Override
public boolean onPreUpdate(PreUpdateEvent event) {
Object entity = event.getEntity();
Serializable id = event.getId();
encrypt(entity, id, event.getState());
return false;
}
示例5: onPreUpdate
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
@Override
public boolean onPreUpdate(PreUpdateEvent event) {
String updateMessage = buildUpdateMessage(event);
if (!updateMessage.isEmpty()) {
audit(event, Modification, event.getEntity(), updateMessage);
}
return false;
}
示例6: onPreUpdate
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
@Override
public boolean onPreUpdate(PreUpdateEvent event) {
if (event.getEntity() instanceof UpdatedTimestampEntity) {
((UpdatedTimestampEntity) event.getEntity()).updateUpdatedTimestamp();
}
return true;
}
示例7: onPreUpdate
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
/**
* 엔티티를 갱신하기전에 최종 갱신 시간을 갱신합니다.
*
* @param event 이벤트 정보
* @return event bubbling을 그만 둘 것인가?
*/
@Override
public boolean onPreUpdate(PreUpdateEvent event) {
Object entity = event.getEntity();
if (entity instanceof IUpdateTimestampedEntity) {
((IUpdateTimestampedEntity) entity).updateUpdateTimestamp();
}
return false;
}
示例8: onPreUpdate
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
public boolean onPreUpdate(PreUpdateEvent event) {
performSecurityCheck( event, PermissibleAction.UPDATE );
return false;
}
示例9: onPreUpdate
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
/**
* @see org.hibernate.event.spi.PreUpdateEventListener#onPreUpdate(org.hibernate
* .event.spi.PreUpdateEvent)
*/
@Override
public boolean onPreUpdate(PreUpdateEvent event) {
execute(preUpdate, event.getEntity());
return false;
}
示例10: onPreUpdate
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
@Override
public boolean onPreUpdate(final PreUpdateEvent event) {
return false;
}
示例11: onPreUpdate
import org.hibernate.event.spi.PreUpdateEvent; //导入依赖的package包/类
@Override
public boolean onPreUpdate(PreUpdateEvent pue) {
autowired();
EntityMode entityMode = pue.getPersister().getEntityMode();
RuleContext ruleContext = new RuleContextImplNoPrincipal(pue.getEntity(), getOriginalEntity(pue.getOldState(), pue.getPersister()));
fireRules(ruleContext, pue.getPersister(), pue.getState(), entityMode, RuleGroupPredefined.PreUpdate.class, RuleGroupPredefined.PreInsertOrUpdate.class, RuleGroupPredefined.PreUpdateOrDelete.class, RuleGroupPredefined.PreInsertOrUpdateOrDelete.class);
return false;
}