@Override
 public void nullSafeSet(
     PreparedStatement preparedStatement, Object value, int index, SessionImplementor session)
     throws HibernateException, SQLException {
   if (value == null) {
     StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement, null, index, session);
   } else {
     LocalDateTime ldt = ((LocalDateTime) value);
     Instant instant = ldt.atZone(ZoneId.systemDefault()).toInstant();
     Date timestamp = Date.from(instant);
     StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement, timestamp, index, session);
   }
 }
Esempio n. 2
0
 @Override
 public void nullSafeSet(
     PreparedStatement preparedStatement,
     Object value,
     int index,
     SessionImplementor sessionImplementor)
     throws HibernateException, SQLException {
   if (value == null) {
     StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement, null, index, sessionImplementor);
   } else {
     StandardBasicTypes.TIMESTAMP.nullSafeSet(
         preparedStatement, ((LocalDate) value).toDate(), index, sessionImplementor);
   }
 }
 @Override
 public void nullSafeSet(
     PreparedStatement st,
     Object value,
     int index,
     SharedSessionContractImplementor sharedSessionContractImplementor)
     throws HibernateException, SQLException {
   DateTime dt = (DateTime) value;
   if (dt == null) {
     StandardBasicTypes.TIMESTAMP.nullSafeSet(st, null, index, sharedSessionContractImplementor);
     StandardBasicTypes.STRING.nullSafeSet(st, null, index + 1, sharedSessionContractImplementor);
   } else {
     StandardBasicTypes.TIMESTAMP.nullSafeSet(
         st, dt.toDate(), index, sharedSessionContractImplementor);
     StandardBasicTypes.STRING.nullSafeSet(
         st, dt.getZone().getID(), index + 1, sharedSessionContractImplementor);
   }
 }