-->
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.  [ 4 posts ] 
Author Message
 Post subject: Mapping Question involving sets
PostPosted: Wed Nov 16, 2005 2:12 pm 
Newbie

Joined: Tue Nov 15, 2005 4:23 am
Posts: 2
Hi,
I have a major problem in mapping my DB schema.
My DB schema is like that


Class Store{

Map<integer,ItemLocations> Items;

//item can be in more than one location;
}

class ItemLocations{

Set<string> locations;

}

class Item{
...
...
}


DB:


CREATE TABLE STORES ( ID NUMBER -->PK , ... )

CREATE TABLE ITEM_LOCATIONS
(
STORE_ID NUMBER NOT NULL, ---> PK
ITEM_ID NUMBER NOT NULL, ---> PK
LOCATION VARCHAR2(30 BYTE) ---->PK
)


CREAT TABLE ITEMS( ITEM_ID NUMBER NOT NULL --> PK ,
.... )

I think I should declare a composite-id but I haven't succeeded to understand how to, even after reading the reference document.

Can you help me with the mapping decleration for classes STORE and ITEM_LOCATIONS ??



I'm using Hibernate version 3.0.5


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 16, 2005 3:45 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
Code:
<class
    name="package.Class"
    table="table_name"
   
>
   
    <composite-id name="comp_id" class="package.class">
   
        <key-property
            name="name"
            column="name"
            ...
        >
        </key-property>
        <key-property
            name="name"
            column="name"
          ...
        >
          ...

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject: And how should I map the Store object?
PostPosted: Thu Nov 17, 2005 4:28 am 
Newbie

Joined: Tue Nov 15, 2005 4:23 am
Posts: 2
Can you specify it using my object names?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 2:47 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
sorry i do not have time to write out the schema using your names. what i have posted should be plenty of information to get a good start.

some useful links
http://www.hibernate.org/hib_docs/v3/re ... ompositeid
http://www.hibernate.org/hib_docs/v3/re ... pping.html

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


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