Advertisement
Guest User

Untitled

a guest
Oct 29th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1.  
  2.  
  3. import java.io.Serializable;
  4.  
  5. import org.hibernate.EmptyInterceptor;
  6. import org.hibernate.type.Type;
  7.  
  8.  
  9.  
  10. public class MyIntercepter extends EmptyInterceptor {
  11.  
  12. @Override
  13. public boolean onFlushDirty(Object entity, Serializable id,
  14. Object[] currentState, Object[] previousState,
  15. String[] propertyNames, Type[] types) {
  16.  
  17. if (entity instanceof MyClass) {
  18. id = null;
  19. return super.onSave(entity, id, currentState, propertyNames, types);
  20. }
  21. else {
  22. return super.onFlushDirty(entity, id, currentState, previousState,
  23. propertyNames, types);
  24. }
  25.  
  26.  
  27. }
  28.  
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement