-->
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: one-to-many set problem
PostPosted: Sun Jun 13, 2004 5:14 am 
Newbie

Joined: Wed Jun 09, 2004 3:57 am
Posts: 3
Hi all, first I am new using hibernte so maybe you may excuse my stupid guestion...

I try to use a one-to-many collection between the following classes:

ScaleGroups.hbm.xml
Code:
<?xml version="1.0"?>

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

<hibernate-mapping>
    <class
        name="com.hoellehuettner.persistence.ScaleGroups"
        table="T_SCALEGROUPS"
    >
        <id
            name="IDScaleGroup"
            column="IDSCALEGROUP"
            type="integer"
        >
            <generator class="native">
            </generator>
        </id>
        <set name="Scales" lazy="true">
              <key column="IDSCALEGROUP" />
              <one-to-many class="com.hoellehuettner.persistence.Scales" />
       </set>
    </class>
</hibernate-mapping>


Scales.hbm.xml
Code:
<?xml version="1.0"?>

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

<hibernate-mapping>
    <class name="com.hoellehuettner.persistence.Scales" table="T_SCALES">

        <id name="IDScale" column="IDSCALE" type="integer">
            <generator class="native">
            </generator>
        </id>

        <property name="IDScaleGroup" type="integer">
            <column name="IDSCALEGROUP" not-null="true" unique="false"/>
        </property>

        <property name="name" type="string">
            <column name="SC_NAME" not-null="true" unique="true"/>
        </property>
    </class>

</hibernate-mapping>


hibernate.cfg.xml
Code:
<?xml version='1.0' encoding='utf-8'?>
   <!DOCTYPE hibernate-configuration
      PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
   <hibernate-configuration>
      <session-factory>
         <property name="connection.datasource">java:comp/env/jdbc/HSP</property>
         <property name="show_sql">true</property>
         <property name="use_outer_join">false</property>
         <property name="jta.UserTransaction">java:comp/UserTransaction/</property>
         <property name="dialect">net.sf.hibernate.dialect.SybaseDialect</property>
         <!-- Mapping files -->
         <mapping resource="com/hoellehuettner/persistence/Scales.hbm.xml"/>
         <mapping resource="com/hoellehuettner/persistence/ScaleGroups.hbm.xml"/>
      </session-factory>
   </hibernate-configuration>


Apache Message
Quote:
INFO: Jk running ID=0 time=0/16 config=E:\java\server\jakarta-tomcat-4.1.27\conf\jk2.properties
2004-06-13 11:09:55,343 INFO hibernate.cfg.Environment -> Hibernate 2.0 beta 5
2004-06-13 11:09:55,343 INFO hibernate.cfg.Environment -> loaded properties from resource hibernate.properties: {hibernate.cglib.use_refle
ction_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.SybaseDialect, hibernate.show_sql=true, hibernate.use_outer_join=true, hibe
rnate.jdbc.use_scrollable_resultset=false, hibernate.connection.datasource=java:/comp/env/jdbc/HSP}
2004-06-13 11:09:55,359 INFO hibernate.cfg.Environment -> using CGLIB reflection optimizer
2004-06-13 11:09:55,359 INFO hibernate.cfg.Environment -> JVM proxy support: true
2004-06-13 11:09:55,359 INFO hibernate.cfg.Configuration -> Configuration resource: /hibernate.cfg.xml
2004-06-13 11:09:55,421 INFO hibernate.cfg.Configuration -> Mapping resource: com/hoellehuettner/persistence/Scales.hbm.xml
2004-06-13 11:09:55,468 INFO hibernate.mapping.Collection -> Mapping class: com.hoellehuettner.persistence.Scales -> T_SCALES
2004-06-13 11:09:55,531 INFO hibernate.cfg.Configuration -> Mapping resource: com/hoellehuettner/persistence/ScaleGroups.hbm.xml
2004-06-13 11:09:55,546 INFO hibernate.mapping.Collection -> Mapping class: com.hoellehuettner.persistence.ScaleGroups -> T_SCALEGROUPS


Servlet Exception
Code:
javax.servlet.ServletException: Invoker service() exception
   at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:524)
   at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
...


Should look like a simple sample but invoking the servlet on my apache I get a servlet exception. This only occurs while using the one-to-many relation from ScaleGroup 2 Scales. Normal field mapping or one-to-one mapping seems fine.


Thx in advance for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 13, 2004 2:38 pm 
Beginner
Beginner

Joined: Mon Sep 29, 2003 10:32 pm
Posts: 35
Location: Toronto, Ontario
Possible cause- missing dependent library.
Hibernate uses third party libraries in its code that handles .. to-many relationships. It could be that a dependent jar file is missing from the classpath (WEB-INF/lib). It could be cglib.jar.

Note: Jars required for Hibernate:
cglib.jar, ehcache.jar, commons-collections.jar, dom4j.jar and jta.jar.


Top
 Profile  
 
 Post subject: Problem solved
PostPosted: Mon Jun 14, 2004 2:58 am 
Newbie

Joined: Wed Jun 09, 2004 3:57 am
Posts: 3
Thx for the hint bud. In the lib folder was the ODMG library missing...
This little bugger 'caused the problems.


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.