1 package org.hibernate.type; 3 4 import java.sql.PreparedStatement ; 5 import java.sql.ResultSet ; 6 import java.sql.SQLException ; 7 8 import org.hibernate.EntityMode; 9 import org.hibernate.HibernateException; 10 11 17 public class AdaptedImmutableType extends ImmutableType { 18 19 private final NullableType mutableType; 20 21 public AdaptedImmutableType(NullableType mutableType) { 22 this.mutableType = mutableType; 23 } 24 25 public Object get(ResultSet rs, String name) throws HibernateException, SQLException { 26 return mutableType.get(rs, name); 27 } 28 29 public void set(PreparedStatement st, Object value, int index) throws HibernateException, 30 SQLException { 31 mutableType.set(st, value, index); 32 } 33 34 public int sqlType() { 35 return mutableType.sqlType(); 36 } 37 38 public String toString(Object value) throws HibernateException { 39 return mutableType.toString(value); 40 } 41 42 public Object fromStringValue(String xml) throws HibernateException { 43 return mutableType.fromStringValue(xml); 44 } 45 46 public Class getReturnedClass() { 47 return mutableType.getReturnedClass(); 48 } 49 50 public String getName() { 51 return "imm_" + mutableType.getName(); 52 } 53 54 public boolean isEqual(Object x, Object y) { 55 return mutableType.isEqual(x, y); 56 } 57 58 public int getHashCode(Object x, EntityMode entityMode) { 59 return mutableType.getHashCode(x, entityMode); 60 } 61 62 public int compare(Object x, Object y, EntityMode entityMode) { 63 return mutableType.compare(x, y, entityMode); 64 } 65 } 66 | Popular Tags |