-->
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: Trying to use <join>, without any luck.
PostPosted: Tue Jul 12, 2005 10:38 am 
Beginner
Beginner

Joined: Tue Jul 12, 2005 10:27 am
Posts: 23
My problem is rather unique. I’m trying to map a single object to multiple tables, but one of the tables I’m trying to join on doesn’t have all the columns for the objects primary key.

Example: (Note: This problem uses natural keys and the below is just an example to express the issue.)

Event Table:

Application (PK)
Event Name (PK)
Filter ID (PK)

Event Description Table:

Application (PK)
Event Name (PK)
Description


I need to map the Event object (Expressed below) to these two tables.
Code:
public class Event
{
   private String application;
   private String event;
   private int filterId;
   private String String;

       // setters, getters, equal, hashCode, etc..
}


My composite-id looks like:

Code:
        <composite-id>

            <key-property
                name="application"
                column="I_APPL"/>

            <key-property
                name="event"
                column="C_EVNT_TYP"/>

            <key-property
                name="filterId"
                column="I_EVNT_FILTER"
                access="field"/>

        </composite-id>


My join looks like:
Code:
                <join
                    table="EVENT_TBL"
                    optional="true">

                    <key>
                        <column name="I_APPL"/>
                        <column name="C_EVNT_TYP"/>
                    </key>

                    <property
                        name="description"
                        column="T_EVNT_TYP"/>

                </join>


But because I don’t have all of the columns that define the event in the Event Description table, I receive an error because Hibernate tries to join on ALL of the composite-id fields. Anyone have a solution to this problem?

_________________
- Richard Burton


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.