thank you.....
i will try to do in this way!
but still ia have some doubts like how to implement the hashcode and the key?
for SQL time stamp i implemented a class for the same way..
but for sequence i m not able to get any idea .....
this is the class that i implemented for time stamp.......
package com.met.ib.ecomp.services.util;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import org.hibernate.HibernateException;
import org.hibernate.usertype.UserType;
import java.io.Serializable;
/**
* @author 119660
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class String2SqlTimestampFieldConversion implements UserType{
public String2SqlTimestampFieldConversion() {
super();
}
public int[] sqlTypes() {
return new int[] { Types.TIMESTAMP};
}
public Class returnedClass() {
return String.class;
}
public boolean equals(Object x, Object y) throws HibernateException {
return (x == y) || (x != null && y != null && (x.equals(y)));
}
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
String val = rs.getTimestamp(names[0]).toString();
return val;
}
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
System.out.println(value.getClass());
st.setTimestamp(index, Timestamp.valueOf((String)value));
}
public Object deepCopy(Object value) throws HibernateException {
return value;
}
public boolean isMutable() {
return false;
}
public Object replace(Object Ob1 ,Object Ob2,Object Ob3) throws HibernateException
{
return Ob2;
}
public Serializable disassemble(Object Ob1) throws HibernateException{
return (Serializable)Ob1;
}
public Object assemble(Serializable Ob1,Object Ob2){
return Ob2;
}
public int hashCode(Object Ob1) throws HibernateException{
return 0;
}
}
can anybody help me out in this issue...............
|