I´m sorry if I haven´t investigated enough but I´m not quite an expert in hibernate and I´m tired of looking for something that won´t really solve my specific problem. What I mean is that I am a bit short of time. I have a User class that represents every single user of the system.
Every User has a Set of Roles (which is an enum type) that indicates which resources the user can and cannot acces. Nothing complicated. I am using Hibernate to map this classes but I am having problems with this last part.
It doesn´t bother me at all how the Roles, say, field(which, I repeat, is an enum) is mapped in the DB (could be an int or a String) but it must definetly be an extra table, I guess, which has the fk of the user and the field which corresponds the role to the user, as one user has many roles assigned to it. I am using JPA annotations. I do not believe any sample code is necesary because this is that simple: The user class has a set of enum types which must be mapped with jpa Annotations.
I´m sorry for the bad english but it´s not my native language as you can see. Thanks a lot.
elSifa
0
Newbie Poster
Recommended Answers
Jump to Postidiom:
public enum Roles { KING, SLAVE, OBSERVER, NOTHING }
real representation
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 2010-04-23 22:51:41 // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version! // Decompiler options: packimports(3) fieldsfirst nonlb …
Jump to PostelSifa: please share your solution with us - I for one would certainly like to know the answer!
All 7 Replies
quuba
81
Posting Pro
elSifa
0
Newbie Poster
elSifa
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
elSifa
0
Newbie Poster
msi_333
0
Newbie Poster
quuba
81
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.