1 package org.hibernate.type; 3 4 import java.io.Serializable ; 5 6 import org.hibernate.engine.Cascade; 7 8 12 public abstract class ForeignKeyDirection implements Serializable { 13 protected ForeignKeyDirection() {} 14 18 public abstract boolean cascadeNow(int cascadePoint); 19 20 23 public static final ForeignKeyDirection FOREIGN_KEY_TO_PARENT = new ForeignKeyDirection() { 24 public boolean cascadeNow(int cascadePoint) { 25 return cascadePoint!=Cascade.BEFORE_INSERT_AFTER_DELETE; 26 } 27 28 public String toString() { 29 return "toParent"; 30 } 31 32 Object readResolve() { 33 return FOREIGN_KEY_TO_PARENT; 34 } 35 }; 36 39 public static final ForeignKeyDirection FOREIGN_KEY_FROM_PARENT = new ForeignKeyDirection() { 40 public boolean cascadeNow(int cascadePoint) { 41 return cascadePoint!=Cascade.AFTER_INSERT_BEFORE_DELETE; 42 } 43 44 public String toString() { 45 return "fromParent"; 46 } 47 48 Object readResolve() { 49 return FOREIGN_KEY_FROM_PARENT; 50 } 51 }; 52 } | Popular Tags |