Hi guys,
I've a question, I'm a newbie.
I've a hibernate object, that implemens java.io.Serializable.
Object properties are name, surname, birthdate, that are all persistent and mapped with mapping file.
What I need is a fourth property, age, not mapped to db, that I want to get in my application to runtime calculate age, basing on birthdate that is mapped to db.
Code:
<hibernate-mapping>
<class name="test.entity.User" table="USER" schema="ROOT">
<id name="idUser" column="ID_USER" type="long">
<generator class="identity" />
</id>
<property name="name" type="string">
<column name="NAME" length="100" />
</property>
<property name="surname" type="string">
<column name="SURNAME" length="100" />
</property>
<property name="birthdate" type="date">
<column name="BIRTHDATE" length="10" />
</property>
</class>
</hibernate-mapping>
I need to add a not persisten property, age.
I tried in this way
Code:
<property name="age" type="string">
</property>
without adding column...but it's always persisted to db...how can I proceed? I need a not persistent property in my hibernate object...is there a way? Please help me with some code...thanks