How to configure a jdbc realm in glassfish 3.0
I am following this tutorial i found http://www.vitruvimente.be/?p=768 to create a JDBC realm, so i can login and out my users on my web app, but i have a problem.
But i have 3 different types of users in different classes(Admin,Buyer,Seller) I dont have a single class called users because their attributes are very unrelated. I see in the tutorial they add a property called user-table, whay should i add there?
My question, is what settings should i add at the glassfish new realm page(l开发者_运维技巧ocalhost:4848)? Can somebody give me some tips on how to configure this realm?
i have 3 different types of users in different classes(Admin,Buyer,Seller) I dont have a single class called users because their attributes are very unrelated.
There's something wrong in your model design. You should really have a single table User
with at least the login name and password. For the more specific user roles, you need a table Role
. To relate them to each other, have a join table User_Role
(which you map in Java as a Set<Role>
in User
entity). For the buyer/seller part it makes sense to have a Product
table with a FK to User
(the seller) and an Order
table with a FK to User
(the buyer) and Product
(the ordered item).
After all, you should end up with a single User
table/model which you could then just map in the realm.
If you have changed your model as suggested by BalusC, I would recommend this good tutorial here for setting up a JDBC realm with glassfish.
精彩评论