Results 1 to 3 of 3

Thread: Acegi + lazy loading

  1. #1
    Join Date
    Oct 2005
    Posts
    80

    Default Acegi + lazy loading

    My UserDao.loadByUsername() returns a UserDetails implemented by a User class. Hibernate is the loader of the User, and the User/UserDetails becomes the Authentication object for Acegi.

    So basically this means I have a detached User entity in subsequent requests.

    I want to be able to reuse the User in other requests, and so I had a filter which reattached the object to the current OSIV session. This worked, except when I found out that concurrent requests by the user would make the application bomb :-) The User has a collection of Roles and Hibernate does not allow collections to be associated with more than one session.

    So what's the correct solution? Do I just simply not use the User/Authentication object? Reload the User from the database on each request?

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    What user data is it you are trying to lazy load? Depending on how it's used it might make sense to eagerly load it anyway.
    Last edited by karldmoore; Aug 27th, 2007 at 03:05 PM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  3. #3
    Join Date
    Oct 2005
    Posts
    80

    Default

    The user is attached to a parent account which has a collection of sibling users.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •