-->
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: many-to-many mapping issue
PostPosted: Thu Mar 11, 2004 12:48 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.
When i commented <set> elements in mapping file to find out where the problem is happening.
i get the following error
-------------------------
net.sf.hibernate.QueryException: could not resolve property: weatherCurrent of: com.mycompany.weathermodel.model.WeatherLocationVO [ from com.mycompany.weathermodel.model.WeatherLocationVO as location inner join location.weatherCurrent as current inner join location.weatherForecast as forecast where location.ZIP_CODE = :zip and location.STATION_ID = current.STATION_ID and forecast.DAY_OF_WEEK = :dayOfWeek]
at net.sf.hibernate.persister.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38)
at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:244)

when i uncomment
----------------
this is what happens

===================================================================================================
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: Fri Mar 12, 2004 2:27 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
add odmg.jar in your cp

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 2:31 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
rajoos2004,
it seems you have succed in what you wanted to do in the topic:
http://forum.hibernate.org/viewtopic.php?t=928914

so please close this topic by giving your solution, this can help other users...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 10:13 pm 
Beginner
Beginner

Joined: Mon Mar 08, 2004 5:22 pm
Posts: 35
Sorry i didnt know i should close issues. I added odmg.jar as Emmanuel said. Got rid of this error. Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 13, 2004 5:59 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
i was talking about the previous topic you post:
http://forum.hibernate.org/viewtopic.php?t=928914


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.