-->
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.  [ 5 posts ] 
Author Message
 Post subject: one-to-many relationship problems
PostPosted: Thu Feb 19, 2004 4:06 pm 
Newbie

Joined: Thu Feb 19, 2004 3:53 pm
Posts: 2
I am trying to set up a one-to-many relationship, but keep hitting a wall when I get the following error:
java.lang.NoClassDefFoundError: org/odmg/DCollection
...

Any help would be great!

Andy Jones
=====================================

My classes:
package com.ffic.hibernate_spoe;
import java.util.Set;
public class Insured {
private Long insdID;
private String insdNm;
private String insdBus;
private Set policies;

public String getInsdBus() {return insdBus;}
public Long getInsdID() {return insdID;}
public String getInsdNm() {return insdNm;}
public Set getPolicies() {return policies;}
public void setInsdBus(String string) {insdBus = string;}
public void setInsdID(Long long1) {insdID = long1;}
public void setInsdNm(String string) {insdNm = string;}
public void setPolicies(Set set) {policies = set;}
}

package com.ffic.hibernate_spoe;
import java.util.Date;
public class Policy {
private Long polID;
private String polNo;
private Long limits;
private Date poleffdt;
private Date polexpdt;
private Insured insured;

public Insured getInsured() {return insured;}
public Long getLimits() {return limits;}
public Date getPoleffdt() {return poleffdt;}
public Date getPolexpdt() {return polexpdt;}
public Long getPolID() {return polID;}
public String getPolNo() {return polNo;}
public void setInsured(Insured insured) {this.insured = insured;}
public void setLimits(Long long1) {limits = long1;}
public void setPoleffdt(Date date) {poleffdt = date;}
public void setPolexpdt(Date date) {polexpdt = date;}
public void setPolID(Long long1) {polID = long1;}
public void setPolNo(String string) {polNo = string;}
}

My mappings:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.ffic.hibernate_spoe.Insured" table="a_insured">
<id name="insdID" column="insuredid">
<generator class="identity"/>
</id>
<property name="insdBus" column="insuredbus"/>
<property name="insdNm" column="insuredname"/>
<set name="policies" inverse="true">
<key column="insuredid" />
<one-to-many class="com.ffic.hibernate_spoe.Policy" />
</set>
</class>
</hibernate-mapping>
<!-- parsed in 0ms -->

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.ffic.hibernate_spoe.Policy" table="a_policy">
<id name="polID" column="policyid">
<generator class="identity"/>
</id>
<property name="polNo" column="policyno"/>
<property name="limits"/>
<property name="poleffdt" column="effdate"/>
<property name="polexpdt" column="expdate"/>
<many-to-one name="insured" column="insuredid"/>
</class>
</hibernate-mapping>
<!-- parsed in 0ms -->

My DB2 Create Table script:
CREATE TABLE IMUN0D00.A_INSURED ("INSUREDID" BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1, NO CACHE ) , "INSUREDNAME" CHARACTER (25) NOT NULL , "INSUREDBUS" CHARACTER (25) NOT NULL , PRIMARY KEY (INSUREDID) ) DATA CAPTURE NONE
CREATE TABLE IMUN0D00.A_POLICY ("POLICYID" BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1, NO CACHE ) , "POLICYNO" CHARACTER (11) NOT NULL , "LIMITS" BIGINT NOT NULL , "EFFDATE" DATE NOT NULL , "EXPDATE" DATE NOT NULL , "INSUREDID" BIGINT NOT NULL , PRIMARY KEY (POLICYNO, POLICYID) , FOREIGN KEY (INSUREDID) REFERENCES IMUN0D00.A_INSURED (INSUREDID) ) DATA CAPTURE NONE


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 4:08 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The class definition for an ODMG class could not be found. In other wirds, you need odmg.jar in your classpath.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 4:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You are missing the odmg.jar in your classpath. Take a look at the readme file in the lib directory of the hibernate distribution for a list of required jars.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 4:19 pm 
Newbie

Joined: Thu Feb 19, 2004 3:53 pm
Posts: 2
Thanks!

It worked!

I tried to read the readme.txt in lib, but it is not very readable. Is it supposed to be opened via notepad?

Andy


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 7:23 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
ajones wrote:
I tried to read the readme.txt in lib, but it is not very readable. Is it supposed to be opened via notepad?

everything but notepad can render it fine. Notepad is confused about unix end of line.

_________________
Emmanuel


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