Пример #1
0
  @Override
  public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
      throws HibernateException, SQLException {

    Date start = (Date) DateType.INSTANCE.nullSafeGet(rs, names[0], session, owner);
    Date end = (Date) DateType.INSTANCE.nullSafeGet(rs, names[1], session, owner);

    return new DateTimeRange(new DateTime(start), new DateTime(end));
  }
Пример #2
0
  @Override
  public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
      throws HibernateException, SQLException {

    if (value == null) {
      DateType.INSTANCE.nullSafeSet(st, null, index, session);
      DateType.INSTANCE.nullSafeSet(st, null, index + 1, session);
    } else {
      DateTimeRange range = asDateTimeRange(value);
      DateType.INSTANCE.nullSafeSet(st, range.getStart(), index, session);
      DateType.INSTANCE.nullSafeSet(st, range.getEnd(), index + 1, session);
    }
  }