Matt RaibleMatt Raible is a Java Champion and Developer Advocate at Okta.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

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

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 09: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 09:07 PM MST #

Post a Comment:
  • HTML Syntax: Allowed