Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.Serializable;
- import org.hibernate.EmptyInterceptor;
- import org.hibernate.type.Type;
- public class MyIntercepter extends EmptyInterceptor {
- @Override
- public boolean onFlushDirty(Object entity, Serializable id,
- Object[] currentState, Object[] previousState,
- String[] propertyNames, Type[] types) {
- if (entity instanceof MyClass) {
- id = null;
- return super.onSave(entity, id, currentState, propertyNames, types);
- }
- else {
- return super.onFlushDirty(entity, id, currentState, previousState,
- propertyNames, types);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement