List of usage examples for org.hibernate.type StandardBasicTypes CURRENCY
CurrencyType CURRENCY
To view the source code for org.hibernate.type StandardBasicTypes CURRENCY.
Click Source Link
From source file:org.jboss.as.test.compat.jpa.hibernate.transformer.MonetaryAmountUserType.java
License:Open Source License
public Type[] getPropertyTypes() { return new Type[] { StandardBasicTypes.BIG_DECIMAL, StandardBasicTypes.CURRENCY }; }
From source file:org.jboss.as.test.compat.jpa.hibernate.transformer.MonetaryAmountUserType.java
License:Open Source License
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor 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); }
From source file:org.jboss.as.test.compat.jpa.hibernate.transformer.MonetaryAmountUserType.java
License:Open Source License
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor 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); }