Forums Register Login

Generating the value of a property.

+Pie Number of slices to send: Send
Hi all,

I am having this problem with generating the value for a column.

I have a java bean with an attribute called "createDate" having type as Timestamp.
I have mapped this property in the .hbm.xml file as

<property name="createDate" column="create_date" update="false" type="timestamp" generated="insert"/>
I want the value for this column to be generated at insert time,as the current date time value.

The problem is with the generated="insert". If I include this in the mapping file, this is the error i am getting

Attribute "generated" must be declared for element type "property".

The Doctype declaration is as follows:

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">



Any solutions on this.
Thanks in advance for the help.
+Pie Number of slices to send: Send
I had a look at the dtd. Its does contain the attribute "generated" for the "property" element. Can you post your entire hbm file and the full exception stacktrace that you are seeing?
This guy is skipping without a rope. At least, that's what this tiny ad said:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1673 times.
Similar Threads
Hibernate : generated attribute of the property element
Retereive data by ORDER BY
How could I map this if possible?
Hibernate Mapping (Many-To-One Association). Problem. This forum is my last hope.
Issue in inserting into DB using Hibernate, Spring
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:01:21.