registerHibernateType( Types.DOUBLE, StandardBasicTypes.BIG_DECIMAL.getName() );
@Override public Object nullSafeGet( ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { BigDecimal amt = StandardBasicTypes.BIG_DECIMAL.nullSafeGet( rs, names[0], session ); Currency cur = StandardBasicTypes.CURRENCY.nullSafeGet( rs, names[1], session ); if (amt==null) return null; return new MonetoryAmount(amt, cur); }
@Override public void nullSafeSet( PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { MonetoryAmount ma = (MonetoryAmount) value; BigDecimal amt = ma == null ? null : ma.getAmount(); Currency cur = ma == null ? null : ma.getCurrency(); StandardBasicTypes.BIG_DECIMAL.nullSafeSet(st, amt, index, session); StandardBasicTypes.CURRENCY.nullSafeSet(st, cur, index+1, session); }
/** * {@inheritDoc} */ @Override public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { if (value == null) { st.setNull(index, StandardBasicTypes.STRING.sqlType()); st.setNull(index + 1, StandardBasicTypes.BIG_DECIMAL.sqlType()); } else { Piece piece = (Piece) value; String unitType = piece.getUnitType().toString(); st.setString(index, unitType); st.setBigDecimal(index + 1, piece.getMagnitude()); } }
Query query = session.createSQLQuery("select AUDIANCE_NO as audianceno , MSG_BODY as messageBody from SMS_MSG_QUEUE").addScalar("audianceno" , new BigDecimalType()).addScalar("messageBody" , new StringType()).setResultTransformer(Transformers.aliasToBean(AudinceInfo.class));
@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); } }
/** * {@inheritDoc} * * @throws SQLException * in case of database errors */ @Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException { if (value == null) { st.setNull(index, StandardBasicTypes.STRING.sqlType()); st.setNull(index + 1, StandardBasicTypes.BIG_DECIMAL.sqlType()); } else { Piece piece = (Piece) value; String unitType = piece.getUnitType().toString(); st.setString(index, unitType); st.setBigDecimal(index + 1, piece.getMagnitude()); } }
public static final NullableType BIG_DECIMAL = new BigDecimalType();
registerHibernateType( Types.LONGVARCHAR, StandardBasicTypes.TEXT.getName() ); registerHibernateType( Types.LONGVARBINARY, StandardBasicTypes.IMAGE.getName() ); registerHibernateType( Types.NUMERIC, StandardBasicTypes.BIG_DECIMAL.getName() ); registerHibernateType( Types.DECIMAL, StandardBasicTypes.BIG_DECIMAL.getName() ); registerHibernateType( Types.BLOB, StandardBasicTypes.BLOB.getName() ); registerHibernateType( Types.CLOB, StandardBasicTypes.CLOB.getName() );
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { BigDecimal amt = StandardBasicTypes.BIG_DECIMAL.nullSafeGet( rs, names[0], session); Currency cur = StandardBasicTypes.CURRENCY.nullSafeGet( rs, names[1], session ); if ( amt == null ) return null; return new MonetaryAmount( amt, cur ); }
public void nullSafeSet( PreparedStatement st, Object value, int index, SharedSessionContractImplementor session ) throws HibernateException, SQLException { MonetaryAmount ma = (MonetaryAmount) value; BigDecimal amt = ma == null ? null : ma.getAmount(); Currency cur = ma == null ? null : ma.getCurrency(); StandardBasicTypes.BIG_DECIMAL.nullSafeSet( st, amt, index, session ); StandardBasicTypes.CURRENCY.nullSafeSet( st, cur, index + 1, session ); }
typeName = BigDecimalType.INSTANCE.getName(); } else if (javaType == BigInteger.class) { typeName = BigIntegerType.INSTANCE.getName();
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { BigDecimal amt = StandardBasicTypes.BIG_DECIMAL.nullSafeGet( rs, names[0], session); Currency cur = StandardBasicTypes.CURRENCY.nullSafeGet( rs, names[1], session ); if ( amt == null ) return null; return new MonetaryAmount( amt, cur ); }
public void nullSafeSet( PreparedStatement st, Object value, int index, SharedSessionContractImplementor session ) throws HibernateException, SQLException { MonetaryAmount ma = (MonetaryAmount) value; BigDecimal amt = ma == null ? null : ma.getAmount(); Currency cur = ma == null ? null : ma.getCurrency(); StandardBasicTypes.BIG_DECIMAL.nullSafeSet( st, amt, index, session ); StandardBasicTypes.CURRENCY.nullSafeSet( st, cur, index + 1, session ); }
typeName = BigDecimalType.INSTANCE.getName(); } else if (javaType == BigInteger.class) { typeName = BigIntegerType.INSTANCE.getName();
@Override public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { return new Percentage((BigDecimal) BIG_DECIMAL.nullSafeGet(rs, names, session, owner)); }
@Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { BIG_DECIMAL.nullSafeSet(st, ((Percentage) value).asBigDecimal(), index, session); } }
registerHibernateType( Types.LONGVARCHAR, StandardBasicTypes.TEXT.getName() ); registerHibernateType( Types.LONGVARBINARY, StandardBasicTypes.IMAGE.getName() ); registerHibernateType( Types.NUMERIC, StandardBasicTypes.BIG_DECIMAL.getName() ); registerHibernateType( Types.DECIMAL, StandardBasicTypes.BIG_DECIMAL.getName() ); registerHibernateType( Types.BLOB, StandardBasicTypes.BLOB.getName() ); registerHibernateType( Types.CLOB, StandardBasicTypes.CLOB.getName() );
@Override public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { BigDecimal amount = BigDecimalType.INSTANCE.nullSafeGet(rs, names[0], session); String currencyCode = StringType.INSTANCE.nullSafeGet(rs, names[1], session); return amount == null && currencyCode == null ? null : Money.of(CurrencyUnit.getInstance(currencyCode), amount); }
registerHibernateType( Types.LONGVARCHAR, StandardBasicTypes.TEXT.getName() ); registerHibernateType( Types.LONGVARBINARY, StandardBasicTypes.IMAGE.getName() ); registerHibernateType( Types.NUMERIC, StandardBasicTypes.BIG_DECIMAL.getName() ); registerHibernateType( Types.DECIMAL, StandardBasicTypes.BIG_DECIMAL.getName() ); registerHibernateType( Types.BLOB, StandardBasicTypes.BLOB.getName() ); registerHibernateType( Types.CLOB, StandardBasicTypes.CLOB.getName() );