-->
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.  [ 3 posts ] 
Author Message
 Post subject: mapping issue
PostPosted: Thu Mar 11, 2004 3:41 pm 
Beginner
Beginner

Joined: Mon Mar 08, 2004 5:22 pm
Posts: 35
New to Hibernate. I checked the manual too, i couldnt find the reason for the problem.
I get this following exception with following settings.

===================================================================================================
11:31:18,978 INFO Binder:225 - Mapping class: com.mycompany.weathermodel.model.WeatherLocationVO -> weather_location
11:31:19,072 INFO Binder:534 - Mapping collection: com.mycompany.weathermodel.model.WeatherLocationVO.weatherForecast -> weather_forecast
java.lang.NoClassDefFoundError: org/odmg/DCollection
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:695)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:133)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:319)
at java.net.URLClassLoader.access$400(URLClassLoader.java:92)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:677)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:238)
at java.lang.ClassLoader.loadClass(ClassLoader.java:514)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:441)
at java.lang.ClassLoader.loadClass(ClassLoader.java:446)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:695)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:133)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:319)
at java.net.URLClassLoader.access$400(URLClassLoader.java:92)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:677)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:238)
at java.lang.ClassLoader.loadClass(ClassLoader.java:514)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:441)
at java.lang.ClassLoader.loadClass(ClassLoader.java:446)
at net.sf.hibernate.type.TypeFactory.set(TypeFactory.java:198)
at net.sf.hibernate.mapping.Set.getCollectionType(Set.java:29)
at net.sf.hibernate.mapping.Collection.getType(Collection.java:275)
at net.sf.hibernate.cfg.Binder.bindProperty(Binder.java:422)
at net.sf.hibernate.cfg.Binder.createProperty(Binder.java:1041)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1022)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:344)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1204)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:247)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:281)
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:322)
at com.mycompany.test.WeatherModelTest.prepareWeatherConfiguration(WeatherModelTest.java:78)
at com.mycompany.test.WeatherModelTest.testWeather(WeatherModelTest.java:55)
at com.mycompany.test.WeatherModelTest.main(WeatherModelTest.java:43)
===================================================================================================
package com.mycompany.weathermodel.model;
import java.util.Set;
public class WeatherLocationVO
{
private String zip_code;
private String location_id;
private String station_id;
private String city;
private String county;
private String state;
private Set weatherCurrent;
private Set weatherForecast;
private Set weatherImages;

public String getCity(){return city;}
public String getCounty(){return county;}
public String getLocation_id(){return location_id;}
public String getState(){return state;}
public String getStation_id(){return station_id;}
public String getZip_code(){return zip_code;}
public void setCity(String city){this.city = city;}
public void setCounty(String county){this.county = county;}
public void setLocation_id(String location_id){this.location_id = location_id;}
public void setState(String state){this.state = state;}
public void setStation_id(String station_id){this.station_id = station_id;}
public void setZip_code(String zip_code){this.zip_code = zip_code;}
// =================== COLLECTIONS ===================
public Set getWeatherCurrent(){return weatherCurrent;}
public void setWeatherCurrent(Set weatherCurrent){this.weatherCurrent = weatherCurrent;}
public Set getWeatherForecast(){return weatherForecast;}
public void setWeatherForecast(Set weatherForecast){this.weatherForecast = weatherForecast;}
public Set getWeatherImages(){return weatherImages;}
public void setWeatherImages(Set weatherImages){this.weatherImages = weatherImages;}
}
===================================================================================================
<?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="com.mycompany.weathermodel.model.WeatherLocationVO" table="weather_location">
<id name="zip_code">
<generator class="uuid.hex"/>
</id>
<property name="station_id"/>
<property name="location_id"/>
<property name="city"/>
<property name="county"/>
<property name="state"/>
<set name="weatherCurrent" lazy="true" table="weather_current">
<key column="ZIP_CODE"/>
<many-to-many class="com.mycompany.weathermodel.model.WeatherCurrentVO" column="STATION_ID"/>
</set>
<set name="weatherForecast" lazy="true" table="weather_forecast">
<key column="ZIP_CODE"/>
<many-to-many class="com.mycompany.weathermodel.model.WeatherForecastVO" column="LOCATION_ID"/>
</set>
<set name="weatherImages" lazy="true" table="weather_images">
<key column="ZIP_CODE"/>
<many-to-many class="com.mycompany.weathermodel.model.WeatherImagesVO" column="IMAGE_ID"/>
</set>
</class>
<class name="com.mycompany.weathermodel.model.WeatherCurrentVO" table="weather_current">
<id name="station_id">
<generator class="uuid.hex"/>
</id>
<property name="temperature"/>
<property name="dewpoint"/>
<property name="relative_humidity"/>
<property name="wind_speed"/>
<property name="wind_direction"/>
<property name="gust"/>
<property name="pressure"/>
<property name="visibility"/>
<property name="heat_index"/>
<property name="wind_chill"/>
<property name="six_hr_max"/>
<property name="twentyfour_hr_max"/>
<property name="six_hr_min"/>
<property name="twentyfour_hr_min"/>
<property name="weather"/>
<property name="sky"/>
<property name="ceiling"/>
<property name="snow_depth"/>
<property name="three_hr_precip"/>
<property name="six_hr_precip"/>
<property name="twentyfour_hr_precip"/>
<property name="update_time"/>
</class>
<class name="com.mycompany.weathermodel.model.WeatherForecastVO" table="weather_forcast">
<id name="location_id">
<generator class="uuid.hex"/>
</id>
<property name="us_location_flag"/>
<property name="uv_desc"/>
<property name="moonphase"/>
<property name="day_of_week"/>
<property name="hi_temp_f"/>
<property name="lo_temp_f"/>
<property name="hi_temp_c"/>
<property name="lo_temp_c"/>
<property name="sky24"/>
<property name="uv_indx"/>
<property name="sunrise"/>
<property name="sunset"/>
<property name="moonrise"/>
<property name="moonset"/>
</class>
<class name="com.mycompany.weathermodel.model.WeatherImagesVO" table="weather_images">
<id name="image_id">
<generator class="uuid.hex"/>
</id>
<property name="image_desc"/>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 3:46 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Read the quickstart chapter again and put the required libraries in your classpath (note that ehchache.jar is also required if don't turn it off explicitely in hibernate.properties).

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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 3:46 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
just put odmg.jar on your classpath (it's given with hibernate package), you may need others...


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