-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: not auto generating primary key mapping error
PostPosted: Fri Apr 09, 2004 4:24 am 
Beginner
Beginner

Joined: Wed Mar 24, 2004 8:43 am
Posts: 42
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>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 09, 2004 7:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Specify a generator type. Use "assigned" for self assigned ids


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.