- This topic has 2 replies, 2 voices, and was last updated 19 years, 3 months ago by crajkumar.
-
AuthorPosts
-
madisonDaveMemberHi
When I select the table and generate Hibernate from it, the hbm.xml file shows an exception. It reads as follows:
Severity Description Resource In Folder Location Creation Time
2 The content of element type “class” must match “(meta*,subselect?,cache?,synchronize*,comment?,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array|query-list)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*)”. Person.hbm.xml BasicDB/src/org/david line 16 September 8, 2005 10:27:26 AMThe computer, Eclipse, and Java info are as follows:
OS
Windows 2000 5.00.2195
Service Pack 4Eclipse
Versoin 3.1.0
Build id: I20050627-1435
Fresh Install for testing MyEclipseJava
j2sdk1.4.2_05
MyEclipse
Version 4.0.0 GA
Build Id 20050829-4.0.0-GAI hope this helps.
David
madisonDaveMemberHi
The original file had the following errors.
The class entity did not have the package structure correct. Originally the file came out like <class name=”Person” table=”person”>
Then there was no id element at all. The table column Seq_Id which is an auto-generated PK was not read properly. This element came out as:
<property name=”seq_id” …./>
I don’t know whether this is a Hibernate error or rather the auto-generation of the Hibernate files is not correct. Also the hibernate config didn’t have a dialect element.
David
<class name=”org.David.Person” table=”Person”>
<id name=”id” type=”integer”>
<column name=”Seq_Id” sql-type=”integer” not-null=”true”/>
<generator class=”identity”/>
</id>
<property name=”firstName” column=”First_Name” type=”string” />
<property name=”lastName” column=”Last_Name” type=”string” />
</class>
crajkumarMemberYour hbm.xml file should be the following format
<?xml version=”1.0″?>
<!DOCTYPE hibernate-mapping PUBLIC
“-//Hibernate/Hibernate Mapping DTD 2.0//EN”
“http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd”>
<hibernate-mapping>
<class name=”UserDto” table=”users”>
<id name=”idusers” column=”idusers” type=”int”>
<generator class=”increment”/>
</id><property name=”username” column=”username” type=”string” />
<property name=”password” column=”password” type=”string” />
<property name=”active” column=”active” type=”int” />
</class>
</hibernate-mapping> -
AuthorPosts