3

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.

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.

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109

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,575
  • 5
  • 35
  • 49