• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Hibernate : generated attribute of the property element

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am started reading hibernate. In one of my examples,I mentioned the "generated" attribute of the "property" element as generated="always" as per the hibernate documentation and some other book. But getting the below parser error.

public class Student {

private Long id;
private String name;
private int age;
private Date updated;

// getters and setters
}


Mapping :



In my main class ...



But I am getting the below error when I run the code :



If I try with generated="true" as shown below, the IDE is reporting error but the code is running.

<property name="updated" column="LAST_MODIFIED" update="false" insert="false" generated="true"/>

In the hibernate-mapping-3.0.dtd file of the hibernate jar, I could see below lines :

<!ELEMENT property (meta*,(column|formula)*,type?)>
<!ATTLIST property name CDATA #REQUIRED>
<!ATTLIST property node CDATA #IMPLIED>
<!ATTLIST property access CDATA #IMPLIED>
<!ATTLIST property type CDATA #IMPLIED>
<!ATTLIST property column CDATA #IMPLIED>
<!ATTLIST property length CDATA #IMPLIED>
<!ATTLIST property precision CDATA #IMPLIED>
<!ATTLIST property scale CDATA #IMPLIED>
<!ATTLIST property not-null (true|false) #IMPLIED>
<!ATTLIST property unique (true|false) "false">
<!ATTLIST property unique-key CDATA #IMPLIED>
<!ATTLIST property index CDATA #IMPLIED> <!-- include the columns spanned by this property in an index -->
<!ATTLIST property update (true|false) #IMPLIED>
<!ATTLIST property insert (true|false) #IMPLIED>
<!ATTLIST property optimistic-lock (true|false) "true"> <!-- only supported for properties of a class (not component) -->
<!ATTLIST property formula CDATA #IMPLIED>
<!ATTLIST property lazy (true|false) "false">
<!ATTLIST property generated (true|false) "false">

Could some one please advice, what I am doing wrong. Does it mean the documentation is not correct or am I missing something ??
 
Reddy Prashanth
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I figured out the cause. The hibernate version configured in my IDE is old one (3.1.x) . I checked with 3.2.4 and it is working fine now

 
reply
    Bookmark Topic Watch Topic
  • New Topic