Hi
MonetaryAmount class from HiA book is immutable but when I try to code it using xDoclet and Spring's HibernateTemplate class, I run into a series of problems, in the end, to make it work I have to turn it into a mutable class with setter fields
for Currency and BigDecimal properties.
E.g.
Mapping for Item class with component mapping to MonetaryAmount as
reservePrice
Code:
<hibernate-mapping>
<class
name="org.ecomfuse.model.Item"
table="item"
<component name="reservePrice">
<property name="currency">
<column
name="reserve_price_currency"
not-null="true"/>
</property>
</component>
.......
</class>
</hibernate-mapping>
Now my question is, is it possible to map an immutable class
with empty setter methods in hibernate using component tag?
If not possible, what's the practice you ppl use to map immutable class? (implementing UserType I guess..)
Thanks,
Sam