Hi all,
Im trying to persist an object of MyClass with the following mapping file. When the attribute 'duration' of type
'org.joda.time.Duration' is stored in the database, its getting stored as raw data. Is there a way to store the duration as a number in the database and allow conversions from/to org.joda.time.Duration to/from the number?
<hibernate-mapping>
<class name="MyClass" table="MY_TABLE">
<id name="id" column="AN_ID" type="long" unsaved-value="0">
<generator class="increment"/>
</id>
<timestamp name="lastModified" column="LAST_MODIFIED"/>
<property name="name" column="NAME" type="java.lang.String" length="10" not-null="true"/>
<property name="duration" column="DURATION" type="org.joda.time.Duration" not-null="false"/>
</class>
</hibernate-mapping>
The database table is created using the following SQL on Oracle9 using hibernate's SchemaExportTask:
create table MY_TABLE(AN_ID number(19,0) not null, LAST_MODIFIED timestamp not null, NAME varchar2(10 char) not null, DURATION raw(255), primary key (AN_ID));
Thanks a lot :)
Madhav
