-->
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: How to persist Permissions classes
PostPosted: Tue Apr 12, 2005 12:50 pm 
Newbie

Joined: Fri Apr 02, 2004 2:34 am
Posts: 8
Location: Germany
Hibernate version:
3.0
Mapping documents:
not yet done
Name and version of the database you are using:
HSQL

The question is more conceptual question.
I have a simple class hierarchy - User has multiple Roles encapsulates multiple Permissions
Permissions are implemented as a child to java.security.Permission class. Every permission has its own class, so there classes like READ, EDIT, DELETE (children of my CommonPermission class)
I need to make Role instances persistent. The question is, how?
1. DB schema should be clear.
2. I'ts ok if permissions information will be lost as soon as row from Role table will be deleted
3. I would like as little Hibernate dependent code as possible
4. Ideal case whould be a separate table Permissions where with three rows (one for READ, EDIT and DELETE) and many-to-many association table

But the problem is that I have multiple classes with the same structure (i.e.
same field, different content hardcoded in the classes code).
Is it possible to map one-to-many to the custom type. For example
Table Roles:
-----------
ID | Name
1 Anonymous
2 Admin
3 Editor

Table Roles-To-Permissions
---------------
ROLE_ID | PERMISSION_VALUE
1 3
1 2
1 4
3 1

Table Permission (this table may not exists in simplest case)
---------------------
ID | Name
1 READ
2 EDIT
3 DELETE
4 RESTART

_________________
Br.
Renat


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.