3

I need some advice regarding my mapping. Actually, i'm working on an application (JEE,Hibernate 3, Struts2) in which i have two profiles (Admin, Process) and i need to authenticate my users and redirect them into different jsp pages with different menus.

Well my question is what i can do best for the mapping: an admin table + a process table that inherits from user and use the discriminator tag into the mapping of user? Or should i do a one to one mapping between the user table and the other tables ?

Ps: I'm using an xml file for mapping.

Thanks

Robin Green
  • 30,802
  • 16
  • 100
  • 180

1 Answers1

1

I would suggest the latter option; having a single user table unless there's advantagse to having multiple tables for user types. Most times it's sufficient to add a column on your users table or a 'role', 'type', 'profile' etc. If the types of users your system has will have vastly different needs/uses it might be worth splitting them into separate tables. With database design I always try to make it only as complicated as the circumstances dictate.

If you anticipate having more than 2 user types/roles you may want to go with a more comprehensive design. Something basic like the Users, Roles, User_roles design described here: How to design a user/role schema in a SQL Server database?

Community
  • 1
  • 1
Durandal
  • 5,358
  • 4
  • 33
  • 48