david wrote:
Make one or more (or all) properties the primary (composite) key in the mapping.
thank you for reply, but view hasn't a key, I try to make a key as below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="com.babycare.database">
<class
name="ClassList"
table="CLASS_LIST"
>
<id name="Id" type="integer" column="CLASS_ID">
<generator class="native"/>
</id>
<property column="TERMS_ID" name="termsId" type="string" />
<property column="COURSE_NAME" length="30" name="courseName" type="string"/>
<property column="COURSE_ID" length="6" name="courseId" type="string"/>
<property column="CLASSROOM" length="5" name="classroom" type="short"/>
<property column="TIMETABLE" length="5" name="timetable" type="short"/>
<property column="WEEKNO" length="4" name="weekno" type="string"/>
<property column="REAL_STUDENTNUM" length="5" name="realStudentnum" type="short"/>
<property column="RESERVE_STUDENTNUM" length="5" name="reserveStudentnum" type="short"/>
<property column="STATUS" length="20" name="status" type="string"/>
<property column="CENTER_ID" length="8" name="centerId" type="string"/>
</class>
</hibernate-mapping>
There isn't parse error this time, but another error as below:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.babycare.townsend.testdb.main(testdb.java:22)
Caused by: java.lang.RuntimeException: Exception building SessionFactory: could not instantiate id generator
at com.babycare.townsend.HibernateUtil.<clinit>(HibernateUtil.java:28)
... 1 more
will you please give me any advise?