Results 1 to 3 of 3

Thread: Spring + JPA + Hibernate - userid - need to pass to database

  1. #1
    Join Date
    Jan 2007
    Posts
    6

    Default Spring + JPA + Hibernate - userid - need to pass to database

    Hi,

    we are currently using combination of Spring + JPA + Hibernate + Oracle. We use application managed security and all user sessions share the same database account. I need to pass application userid to database (for audit, security etc).

    Is there any way to do it in generic way on Spring, JPA or Hibernate level? Right now we code out DAOs to extend JpaDaoSupport. Simply we need to pass it (call stored procedure that would set up environment variable or so) every time new EntityManager is created. Did anyone do anything like that in the past? Thanks

    Tomas

  2. #2
    Join Date
    Jan 2007
    Posts
    6

    Default

    Please ignore this thread. Posted by mistake. My apologies.

    Tomas

  3. #3
    Join Date
    Jan 2007
    Posts
    2

    Default

    Edit: now I see the reason why you wanted to ignore this thread, it was a double post. all apologies.

    I know you asked people to ignore this, but I have the same kind of question.

    The "best solution" that tech lead wants is for the Java layer to somehow pass the userid. The trick is we don't want to append them in the the sql (or hql actually because we're using hibernate).

    the thinking is that a trigger will run on insert/update that will grab the userId from the Oracle context (I'm not even sure if that's the right word). So basically, Java sets the userId in the context and then does the insert/update statement (well hibernate executes the statement). Then the trigger runs, grabs the userId and inserts into a log. Has anyone done logging this way? Is it possible?

    Your help is greatly appreciated, Googling phrases has seemed to not work out all that well for me with this task.

Posting Permissions

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