1 package org.apache.ojb.broker.accesslayer.conversions; 2 3 17 18 import java.io.Serializable ; 19 20 import org.apache.commons.lang.SerializationUtils; 21 22 28 public class Object2ByteArrUncompressedFieldConversion implements FieldConversion 29 { 30 31 34 public Object javaToSql(Object source) 35 { 36 if (source == null) 37 return null; 38 try 39 { 40 return SerializationUtils.serialize((Serializable ) source); 41 } 42 catch(Throwable t) 43 { 44 throw new ConversionException(t); 45 } 46 } 47 48 51 public Object sqlToJava(Object source) 52 { 53 if(source == null) 54 return null; 55 try 56 { 57 return SerializationUtils.deserialize((byte[]) source); 58 } 59 catch(Throwable t) 60 { 61 throw new ConversionException(t); 62 } 63 } 64 65 } 66 | Popular Tags |