Hi, I have an enum class in java 1.5 defined like this: public enum MyXXX { A, B, C; }
I want to add in the mapping hbm a derived field (called status) which should return a value of that enum type. How should I do that?
I tried like this: <class name="Test" table="test">
<id name="id" column="id" type="long">
<generator class="increment"/>
</id>
<property name="name" column="name" type="string" length="80"/>
<property name="status"
formula="(SELECT CASE WHEN (name = 'A') THEN 'A' WHEN (name= 'B') THEN 'B' END FROM Test t WHERE t.id = id)"
type="xxx.packeage.MyXXX"/>
</class>
What is wrong?
|