@Override public void nullSafeSet(final PreparedStatement st, final Object value, final int index, final SessionImplementor session) throws HibernateException { try { if (value == null) { st.setNull(index, type.sqlType()); } else { final String identifier = (String) identifierMethod.invoke(value, new Object[0]); type.set(st, identifier, index, session); } } catch (final Exception e) { final StringBuilder stb = new StringBuilder("Exception while invoking identifierMethod '"); stb.append(valueOfMethod.getName()); stb.append("' of enumeration class '"); stb.append(enumClass); stb.append('\''); throw new HibernateException(stb.toString(), e); } }
@Override public void nullSafeSet(final PreparedStatement st, final Object value, final int index, final SessionImplementor session) throws HibernateException { try { if (value == null) { st.setNull(index, type.sqlType()); } else { final String identifier = (String) identifierMethod.invoke(value, new Object[0]); type.set(st, identifier, index, session); } } catch (final Exception e) { final StringBuilder stb = new StringBuilder("Exception while invoking identifierMethod '"); stb.append(valueOfMethod.getName()); stb.append("' of enumeration class '"); stb.append(enumClass); stb.append('\''); throw new HibernateException(stb.toString(), e); } }
@SuppressWarnings("rawtypes") @Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { JsonHolder jsonHolder = (JsonHolder) value; if (jsonHolder != null && jsonHolder.getValue() != null) { StringType.INSTANCE.set(st, jsonHolder.getValue().getClass().getName(), index, session); TextType.INSTANCE.set(st, jsonSerializationService.toJson(jsonHolder.getValue()), index + 1, session); } else { StringType.INSTANCE.set(st, null, index, session); TextType.INSTANCE.set(st, null, index + 1, session); } }
@Override public void nullSafeSet(final PreparedStatement st, final Object value, final int index) throws SQLException { try { if (value == null) { st.setNull(index, type.sqlType()); } else { final String identifier = (String) identifierMethod.invoke(value, new Object[0]); type.set(st, identifier, index); } } catch (final Exception e) { final String message = ExceptionManager.getInstance().getFullMessage("bh_GEUT_6", identifierMethod.getName(), enumClass); throw new HibernateException(message, e); } }
@Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { if (value == null) { BigDecimalType.INSTANCE.set(st, null, index, session); StringType.INSTANCE.set(st, null, index + 1, session); } else { Money money = (Money) value; BigDecimalType.INSTANCE.set(st, money.getAmount(), index, session); StringType.INSTANCE.set(st, money.getCurrencyUnit().getCurrencyCode(), index + 1, session); } }