we've got following situation in our application:
- we have
usergroups - these can created user
- the user can map
users givenusergroup(n:m relationship)
now need special usergroups can access in java code. when it's done, user should see mix of own created usergroups , our hard coded groups (which of course cannot deleted).
the first idea put groups in database when it's created , rely on fact in there, i think that's bad practice. (because system crash if deleted or renamed)
the second idea have enum special groups. pretty fine. of course can't extend enum , place additional values in it.
i think, should enum in code can place our hard coded groups (for easy referencing), , has somehow connected database, user can user <-> usergroup mapping (for own created groups , our special groups).
so need else, what?
edit:
we've chosen alternative solution, won't disturb normal database designs:
user group_user group action -------- ---------------- --------- -------------- id | ... groupid | userid id | name groupid | enum as can see, don't try put static groups inside group table, instead expose internal actions user interface, , user can say: "action belongs group x". has several advantages: user can choose name group , can use more 1 group.
so action table , @collectionofelements inside group entity.
it's not exact solution problem above, in our case solves problem in nice way , that's counts ;)
the first idea put groups in database when it's created , rely on fact in there, think that's bad practice. (because system crash if deleted or renamed)
your application crash if database not there @ all, or if tables , columns used application renamed example.
to me, presence of these rows, correct ids or names, prerequisite, presence of tables , columns of right type.
just make sure document fact these rows must present. make sure application doesn't allow renaming or deleting them and, if you're concerned deleting these rows, check hard-coded ids/names you're using in code have corresponding row in database @ startup.
Comments
Post a Comment