-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to retrieve user name ?
PostPosted: Tue Oct 04, 2005 10:24 pm 
Newbie

Joined: Tue Sep 13, 2005 10:14 pm
Posts: 7
Hibernate version: 3

I want to limit the Query with the user name imposed with JDBCRealm.

public List getUserRoleList(String in_usernm)
{
Session session = null;
try
{
session = HibernateUtil.currentSession();
Query query =
session.createQuery(
"select UserRole from com.erp.hibernate.user.UserRole where
UserRole.usernm = :usernm UserRole order by
UserRole.messageKey");
query.setString("usernm", in_usernm);

How to get the login username within Hibernate?

Should it be passed from JSP?

<%
List userRoleList = UserRoleService.getInstance().getUserRoleList(request.getRemoteUser());
request.setAttribute("userRole", userRoleList);
%>

However, request.getRemoteUser() gives nothing.

The output from Query is blank.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 11:29 am 
Regular
Regular

Joined: Sat Aug 28, 2004 4:15 pm
Posts: 61
From : http://java.sun.com/j2ee/sdk_1.3/techdo ... Principal()

getRemoteUser()
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.

Are you positive the user has been authenticated?

_________________
Joe W


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.