20030106 Monday January 06, 2003

How do you store your user's information? After talking with Erik Hatcher a bit, I'm a bit worried about how I'm storing the current user's information. Basically, I'm putting a UserForm (extends ValidatorForm) into the session, and keeping it there to retrieve any user information I might need - in particular the userId. This is not the same as the user's login name, or the value I get from request.getRemoteUser(). How do you do this? I need the user's id from database lookups and filtering drop-downs, etc. Posted in Java at Jan 06 2003, 07:54:05 AM MST 2 Comments

Comments:

I would say that the username should be a key in your database and you use that. We use stateless session beans also, and from there we get the J2EE username from the container and apply it to whatever queries we need.

Posted by Erik Hatcher on January 06, 2003 at 08:29 AM MST #

I agree that using the username as a primary key is the way to go, and I'm lucky enough to have this luxury on my current project. However, on other ones, it's always been a number, and so this luxury wasn't there. I will make an attempt on all future projects to use this philosophy. I guess the reason why I've always kept the user object in the session is (1) it's pretty damn small and (2) it's faster than talking to a DB. Although, I'm using Hibernate now and that sucker flies!

Posted by Matt Raible on January 06, 2003 at 08:07 PM MST #

Post a Comment:
  • HTML Syntax: Allowed
Click me to subscribe
Matt Raible is a Web Architect who enjoys developing applications with open source technologies. Contact me for rates.
« January 2009
SunMonTueWedThuFriSat
    
1
2
3
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
       
Today

Recent Entries

Tag Cloud