1 package org.hibernate.test.rowid; 3 4 import java.io.Serializable ; 5 import java.sql.PreparedStatement ; 6 import java.sql.ResultSet ; 7 import java.sql.SQLException ; 8 import java.sql.Types ; 9 10 import org.hibernate.HibernateException; 11 import org.hibernate.usertype.UserType; 12 13 16 public class RowIdType implements UserType { 17 18 public int[] sqlTypes() { 19 return new int[] { Types.JAVA_OBJECT }; 20 } 21 22 public Class returnedClass() { 23 return Object .class; 24 } 25 26 public boolean equals(Object x, Object y) throws HibernateException { 27 return x.equals(y); 28 } 29 30 public int hashCode(Object x) throws HibernateException { 31 return x.hashCode(); 32 } 33 34 public Object nullSafeGet(ResultSet rs, String [] names, Object owner) 35 throws HibernateException, SQLException { 36 return rs.getObject( names[0] ); 37 } 38 39 public void nullSafeSet(PreparedStatement st, Object value, int index) 40 throws HibernateException, SQLException { 41 throw new UnsupportedOperationException (); 42 } 43 44 public Object deepCopy(Object value) throws HibernateException { 45 return value; 46 } 47 48 public boolean isMutable() { 49 return false; 50 } 51 52 public Serializable disassemble(Object value) throws HibernateException { 53 return null; 54 } 55 56 public Object assemble(Serializable cached, Object owner) throws HibernateException { 57 return null; 58 } 59 60 public Object replace(Object original, Object target, Object owner) throws HibernateException { 61 return null; 62 } 63 64 } 65 | Popular Tags |