Can I use a java primitive type for id in my persistent classes. ("int" for example) ?
If yes, the Session.load metho needs a Serializable object as id value, can I use the java.lang.Integer class even if my class memeber is a primitive "int"? As this: session.load(clazz, new Integer(id));
Other thing: I have a problem which may be linked with my previous question: at the beginning af my application, I got this exception:
net.sf.hibernate.MappingException: Error reading resource ... Caused by: net.sf.hibernate.MappingException: invalid mapping ... Caused by: org.xml.sax.SAXParseException: The content of element type "id" must match "(meta*,column*,generator
I have a very very simple mapping:
<hibernate-mapping>
<class name="test.Entity" table="Entities">
<id name="id" type="int" unsaved-value="0">
<generator class="native"/>
</id>
<property name="name" type="string"/>
</class>
</hibernate-mapping>
|