-->
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: Getting current user from session object
PostPosted: Sun Feb 10, 2008 8:50 am 
Beginner
Beginner

Joined: Sat Dec 01, 2007 4:34 pm
Posts: 20
How do get the user currently logged on from the session object in Hibernate. I'm using Spring and Acegi security filters.

Is this an Spring/Acegi issue?

Normally I would do like this:

Code:
HttpSession session = request.getSession();
String userName = (String) session.getAttribute("USER_NAME");


The HttpSession object is it almost the same as hibernate session object? Can I use it to get the current user?


Code:
Session session = HibernateUtil.getSessionFactory().getCurrentSession();

session.beginTransaction();



Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 11, 2008 4:50 am 
Newbie

Joined: Fri Jan 18, 2008 12:34 pm
Posts: 9
There is NO relationship between the HB Session and the HTTP/Servlet Session. They are two differents objects.

Check in the Acegi/Spring documentation, there is a helper class that can be used the HTTP Session.


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.