-->
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: hibernate mapping for a buddy list
PostPosted: Thu Oct 11, 2007 6:52 am 
Newbie

Joined: Tue Apr 18, 2006 6:43 pm
Posts: 11
i'm implementing an jboss seam application and i want to map a buddy list in JPA (Hibernate Entity Manager).
1 user can have N buddies that are other users, so i have now something similar to this:

Code:
@Entity
class User
{
@OneToMany(mappedBy="user")
private Set<User> = new HashSet<User>(0);
}


and

Code:
public Enum BuddyStatus
{
CONFIRMED, AWAITING_APPROVAL, BLOCKED
}


and

Code:
@Entity
class Buddy
{
    // the user
    @ManyToOne
    private User user;

    // the user
    private User buddy;

    private BuddyStatus status;

}



i have doubts about this implementation. this mean that if i want to block a user, it must be in the buddy set with the blocked state (mixing friends and enemies in the same "bag").

Also i dont know how to map this situation, if it's really an 1-M or an M-N.


Help please?


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.