wood burning stoves*
The moose likes Object Relational Mapping and the fly likes Hibernate : generated attribute of the property element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate : generated attribute of the property element" Watch "Hibernate : generated attribute of the property element" New topic
Author

Hibernate : generated attribute of the property element

Reddy Prashanth
Ranch Hand

Joined: Aug 09, 2005
Posts: 61
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

Joined: Aug 09, 2005
Posts: 61
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

 
wood burning stoves
 
subject: Hibernate : generated attribute of the property element
 
Similar Threads
InvalidMappingException
Automatic Schema Generation
Session throwing NullPointerException
hibernate error
Hibernate: Executing stored procedure using hibernate