Hi,
I'm currently trying to map a monetary amount property to several database columns using a CompositeUserType. Such as the docs say:
http://www.hibernate.org/hib_docs/annot ... c-property
Code:
@Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType")
@Columns(columns = {
@Column(name="r_amount"),
@Column(name="r_currency")
})
public MonetaryAmount getAmount() {
return amount;
}
public class MonetaryAmount implements Serializable {
private BigDecimal amount;
private Currency currency;
...
}
Now, the problem is, this class is used A LOT in a big database. Maintaining @Columns annotations in each object propery is very error-prone (imagine 50 tables, maybe 30 monetary properties suchs athis).
So, is it possible to avoid the @Columns annotation by defining good default columns names? Such as with components and NamingStrategy? I guess it's the CompositeType job to define how many columns and what names should these columns take, right?
Is this planned in the current annotations spec? Or is there another way (other than using components) to do it?
Thanks!