Exemple #1
0
 @Override
 public void nullSafeSet(
     final PreparedStatement st,
     final Object value,
     final int index,
     final SessionImplementor session)
     throws HibernateException, SQLException {
   StringType.INSTANCE.nullSafeSet(st, value != null ? value.toString() : null, index, session);
 }
Exemple #2
0
 @Override
 public Object nullSafeGet(
     final ResultSet rs,
     final String[] names,
     final SessionImplementor session,
     final Object owner)
     throws HibernateException, SQLException {
   final String value = StringType.INSTANCE.nullSafeGet(rs, names[0], session);
   return value != null ? new Money(value) : null;
 }
 @Override
 public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
     throws HibernateException, SQLException {
   try {
     String value = (String) StringType.INSTANCE.nullSafeGet(rs, names, session, owner);
     Class<?> returnedClass = returnedClass();
     Constructor<?> constructor = returnedClass.getConstructor(String.class);
     Object retValue = constructor.newInstance(value);
     return retValue;
   } catch (NoSuchMethodException e) {
     throw new HibernateException(e);
   } catch (InstantiationException e) {
     throw new HibernateException(e);
   } catch (IllegalAccessException e) {
     throw new HibernateException(e);
   } catch (IllegalArgumentException e) {
     throw new HibernateException(e);
   } catch (InvocationTargetException e) {
     throw new HibernateException(e);
   }
 }
 @Override
 public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
     throws HibernateException, SQLException {
   String listValue = ((ListType) value).getValue();
   StringType.INSTANCE.nullSafeSet(st, listValue, index, session);
 }
 @Override
 public int[] sqlTypes() {
   return new int[] {StringType.INSTANCE.sqlType()};
 }