简体   繁体   中英

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(localhost: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.

如果您已经按照BalusC的建议更改了模型,那么我会在这里推荐这个很好的教程来使用glassfish设置JDBC领域

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM