-->
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.  [ 2 posts ] 
Author Message
 Post subject: many to many with maps
PostPosted: Thu Dec 11, 2003 2:11 pm 
Newbie

Joined: Thu Dec 11, 2003 1:51 pm
Posts: 4
Hi,

my classes:

public class User
{
public Integer getId()
{
return(_id);
}

public void setId()
{
_id=id;
}


public Map getGroups()
{
return(_groups);
}

public void setGroups(Map groups)
{
_groups=groups;
}

protected Integer _id;
protected Map _groups;
}



public class Group
{
public Integer getId()
{
return(_id);
}

public void setId()
{
_id=id;
}


public Map getUsers()
{
return(_users);
}

public void setUsers(Map users)
{
_users=users;
}

protected Integer _id;
protected Map _users;
}




my tables:

CREATE TABLE users
(
int id PRIMARY KEY
);

CREATE TABLE groups
(
int id PRIMARY KEY
);

CREATE TABLE group_memberships
(
user_id int REFERENCES users(id),
group_id int REFERENCES groups(id)
);



My goal is that the keys on User.groups were the group.id and
Group.users were the user.id

I've tried many differents mappings after reading the docs... but no way.

Can somebody help me on this mapping??

Thanks in advance.
Congratulations for the great software you make!


Bernardo Antonio Buffa Colome
kreimer@bbs.frc.utn.edu.ar


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 2:29 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
When I tried the same thing some time ago, I have found it is only possible to use entire object (instead of its ID) as Map key.

Probably I missed something.


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