hi
i have database table called users. It is used for user loggings to the system
It contains these fields.
LogonID varchar(20) primary key Name varchar(40) Password varchar(20) EmailAddress varchar(20) LastLogon datetime
but this table does not contain any auto generatiing PK,
when i am going to map this angd trying to login to the syatem following errors occurs. What i want to know is that , does mapping file must contain the generator class ?
this my mapping file for above table
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="test.hibernate.data.User" table="users">
<id name="id"> <column name="LogonID" sql-type="char(32)" not-null="true"/> </id>
<property name="name">
<column name="Name" sql-type="char(32)" not-null="false"/>
</property>
<property name="password">
<column name="Password" sql-type="char(32)" not-null="true"/>
</property>
<property name="email">
<column name="EmailAddress" sql-type="char(32)" not-null="false"/>
</property>
<property name="date">
<column name="LastLogon" sql-type="date" not-null="false"/>
</property>
</class>
</hibernate-mapping>
error
r.hbm.xml
14:21:25,147 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(13) The con
tent of element type "id" is incomplete, it must match "(meta*,column*,generator
)".
14:21:25,257 INFO Binder:220 - Mapping class: test.hibernate.data.User -> users
net.sf.hibernate.MappingException: Error reading resource: test/hibernate/data/U
ser.hbm.xml
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:312)
at test.hibernate.actions.Userlog.doExecute(Userlog.java:48)
at webwork.action.ActionSupport.execute(ActionSupport.java:151)
at webwork.dispatcher.GenericDispatcher.executeAction(GenericDispatcher.
java:131)
at webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:1
74)
<class name="test.hibernate.data.User" table="users">
<id name="id"> <column name="LogonID" sql-type="char(32)" not-null="true"/> </id>
<property name="name">
<column name="Name" sql-type="char(32)" not-null="false"/>
</property>
<property name="password">
<column name="Password" sql-type="char(32)" not-null="true"/>
</property>
<property name="email">
<column name="EmailAddress" sql-type="char(32)" not-null="false"/>
</property>
<property name="date">
<column name="LastLogon" sql-type="date" not-null="false"/>
</property>
</class>
</hibernate-mapping>
|