-->
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: Facing problem when using <generator class="sequence
PostPosted: Wed May 05, 2004 5:10 am 
Newbie

Joined: Mon Apr 19, 2004 10:12 am
Posts: 19
Location: India
Dear All,

I am getting an error viz. Attribute "name" must be declared for element type "param" when trying generate a sequential id.

The created Sequence goes like this:

- Sequence: public.id_custgroup_sequence
CREATE SEQUENCE public.id_custgroup_sequence INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1;
SELECT setval('public.id_custgroup_sequence', 2);

My Table goes like this:

CREATE TABLE public.dummysequence (
dummyid int4 DEFAULT nextval('id_custgroup_sequence'::text) NOT NULL,
name varchar(8),
CONSTRAINT dummysequence_pkey PRIMARY KEY (dummyid)
) WITH OIDS;

I have written a value object for both the fields in the above table and written a HBM file as follows:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping.dtd">

<hibernate-mapping>
<class name="com.phoenixcolor.pcs.vo.customergroup.SerialVO" table="dummysequence">
<id name="dummyid" column="dummyid">
<generator class="sequence">
<param name="sequence">id_custgroup_sequence</param>
</generator>
</id>
<property name="name" column="name"/>
</class>
</hibernate-mapping>

In the application I am trying to save the value object by providing value for the second field i.e. name and expecting hibernate to take care of dummyid value in the table. But found that the hbm is not getting deployed, and the result is the following error.

Attribute "name" must be declared for element type "param".

Thanks in anticipation.

_________________
Ravi Kumar


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 11:25 am 
Beginner
Beginner

Joined: Thu Jan 22, 2004 8:22 pm
Posts: 48
Your DOCTYPE at the top should be for 2.0 if you want to use this feature. It should read like

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

Unless your not using a 2.x version of Hibernate in which case I don't know if/how it works.


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.