-->
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: Multiple Unidirectional ManyToOne mappings to single class
PostPosted: Wed Oct 21, 2009 12:39 pm 
Newbie

Joined: Wed Sep 09, 2009 6:59 am
Posts: 2
Hi,
I have a simple global status field in many of my entity classes (for example, User, UserGroup, Organisation) that should be either set to "LIVE","DEAD" OR "SUSPENDED". One way I could implement this is just using a string field in each of the classes. However, I would prefer to record an entities state using an id (eg id_status) which would be a foreign key to a status table with 3 entries for "LIVE","DEAD" OR "SUSPENDED". Is it possible to have multiple many to one mappings from several classes that point to a single class?


public class GlobalStatus {
private Long idGlobalStatus;
private String name;
...
}


public class User {
private Long idUser;
private String email;
private GlobalStatus status;
...

}

public class UserGroup {
private Long idUserGroup;
private String name;
private GlobalStatus status;
...

}


Top
 Profile  
 
 Post subject: Re: Multiple Unidirectional ManyToOne mappings to single class
PostPosted: Thu Oct 22, 2009 3:48 am 
Newbie

Joined: Fri Mar 20, 2009 4:37 am
Posts: 6
I think it;s better to use enum


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.