-->
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.  [ 1 post ] 
Author Message
 Post subject: Trivial collection mapping not working
PostPosted: Fri Feb 03, 2006 11:47 am 
Newbie

Joined: Fri Nov 04, 2005 4:47 am
Posts: 14
Hi

I'm having problems with what I expected would be an absolutely trivial mapping. I have two classes, Methodology and Decision. For each methodology there can be many decisions, and decisions can't exist without a corresponding Methodology.

The problem is that for my simple test I have a Methodology which I know has 3 Decisions. But when I load the methodology I only find a single decision in the List. Using MySQL's query log I can look at the query that gets executed by Hibernate to fetch the decisions, and I find that the query when executed in the mysql client does in fact return 3 decisions. So what's going on?!

Hibernate version:
3.1.2

Mapping documents:
Code:
<hibernate-mapping package="domain">
  <class name="Decision" table="pro_methodology_decision">
    <id name="id" column="decision_id">
      <generator class="native"/>
    </id>

    <property name="grade" column="grade"/>
    <property name="date" column="date"/>
    <property name="meeting" column="meeting"/>

    <many-to-one name="methodology" class="Methodology" column="methodology_id" not-null="true"/>

  </class>
</hibernate-mapping>

<hibernate-mapping package="domain">
  <class name="Methodology" table="pro_methodology">
    <id name="id" column="methodology_id">
      <generator class="native"/>
    </id>
    <property name="name" column="methodology_name"/>
    <property name="doeId" column="doe_id"/>
    <property name="lastChange" column="last_change"/>
    <property name="lastChangeUser" column="last_change_user"/>
    <property name="ebType" column="eb_type"/>
    <property name="ebId" column="eb_id"/>
    <property name="rev" column="rev"/>

    <many-to-one name="exampleProject" class="Project" column="example_project"/>

    <bag name="decisions" inverse="true">
      <key column="methodology_id"/>
      <one-to-many class="Decision"/>
    </bag>

  </class>
</hibernate-mapping>

Name and version of the database you are using:

MySQL 4.1


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.