-->
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.  [ 6 posts ] 
Author Message
 Post subject: A bug from mapping.. plz help
PostPosted: Mon Jun 21, 2004 11:20 pm 
Newbie

Joined: Mon Mar 15, 2004 1:49 am
Posts: 4
i'm using hibernate 2.0 and mySQL 4.01 with Tomcat 1.4, and i caugh a strange bug,
my old mapping is like this :
<class name="eHap.entity.Nurse" table="nurse">
<id name="nurseId" type="java.lang.String" column="nurse_id">
<generator class="assigned" />
</id>
...
<set name="scheduleList" table="SCHEDULE " order-by="weekday ASC" where="status>0" >
<key column="nurse_id"/>
<one-to-many class="eHap.entity.Schedule"/>
</set>
...
</class>

and
<class name="eHap.entity.Schedule" table="schedule">
..
<many-to-one name="ownNurse" class="eHap.entity.Nurse" not-null="true">
<column name="nurse_id" />
</many-to-one>
...
</class>
my data script is like this :
CREATE TABLE nurse (
nurse_id VARCHAR(15) NOT NULL
....
, PRIMARY KEY (nurse_id)
);
CREATE TABLE schedule
(
schedule_id varchar(32) NOT NULL,
nurse_id varchar(15) NOT NULL,
agency_id varchar(32) NOT NULL,
CONSTRAINT schedule_pkey PRIMARY KEY (schedule_id),
CONSTRAINT fk_schedule_1 FOREIGN KEY (nurse_id) REFERENCES nurse (nurse_id) ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_schedule_2 FOREIGN KEY (agency_id) REFERENCES agency (agency_id) ON UPDATE NO ACTION ON DELETE NO ACTION
);
and the table Agency and nurse is hasnt got any reference
In the first mapping class, i've used table nurse(in lowercase) and table SCHEDULE(in Upper) in the set nam scheduleList,
in the second class, the table is schedule (Lowercase)..
And everything is ok,
but when i changed all table name into UPPERCASE or lowercase, it appeared a bug like this :
net.sf.hibernate.MappingException: Foreign key (schedule[schedule_id])) must have same number of columns as the referenced primary key (schedule[nurse_id,agency_id,schedule_id])
at net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:60)
at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:649)


Plz help me !
Thank you all.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 10:39 pm 
Newbie

Joined: Mon Mar 15, 2004 1:49 am
Posts: 4
No one can help ???


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2004 3:20 am 
Newbie

Joined: Mon Mar 15, 2004 1:49 am
Posts: 4
Hello !! If you can't answer my question, the Hibernate Team, you should post a reply, but i see nothing, so disappointed..
Anyway thanks for more than 30 viewers ..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 12:40 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
schedule is probably a reference keyword of you db, try to rename it

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 05, 2004 12:18 am 
Newbie

Joined: Mon Mar 15, 2004 1:49 am
Posts: 4
thanks for the answer, but plz read carefully:

and the table Agency and nurse is hasnt got any reference
In the first mapping class, i've used table nurse(in lowercase) and table SCHEDULE(in Upper) in the set nam scheduleList,
in the second class, the table is schedule (Lowercase)..
And everything is ok,


And i sure that mySQL doesnt use schedule as keyword as you said

It's not the solution i expected, hibernate founder can't fix a hibernate bug ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 06, 2004 11:32 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Look,
You gave us partial mapping, no code, ... you claim Hibernate has a bug, and you insult me.
How many hundreds of hours have you spend using Hibernate?
Don't expect any help from me anymore.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.