• Post Reply Bookmark Topic Watch Topic
  • New Topic

Generating the value of a property.  RSS feed

 
Janhavi Namshikar
Ranch Hand
Posts: 85
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!