1 package org.hibernate; 3 4 import java.io.Serializable ; 5 import java.util.HashMap ; 6 import java.util.Map ; 7 8 18 public final class FetchMode implements Serializable { 19 private final String name; 20 private static final Map INSTANCES = new HashMap (); 21 22 private FetchMode(String name) { 23 this.name=name; 24 } 25 public String toString() { 26 return name; 27 } 28 31 public static final FetchMode DEFAULT = new FetchMode("DEFAULT"); 32 33 36 public static final FetchMode JOIN = new FetchMode("JOIN"); 37 41 public static final FetchMode SELECT = new FetchMode("SELECT"); 42 43 47 public static final FetchMode LAZY = SELECT; 48 53 public static final FetchMode EAGER = JOIN; 54 55 static { 56 INSTANCES.put( JOIN.name, JOIN ); 57 INSTANCES.put( SELECT.name, SELECT ); 58 INSTANCES.put( DEFAULT.name, DEFAULT ); 59 } 60 61 private Object readResolve() { 62 return INSTANCES.get(name); 63 } 64 65 } 66 67 68 69 70 71 | Popular Tags |