Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8002451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:22:19+00:00 2026-06-04T16:22:19+00:00

We are building a Java EE / JPA / CDI app with an Oracle

  • 0

We are building a Java EE / JPA / CDI app with an Oracle Database. The data model (this we can’t change) implements security partly by using views and client_info…something like..

create view the_view
as select * 
from the_table
where organization_id = USERENV('CLIENT_INFO')

where userenv(‘CLIENT_INFO’) is basically set by calling

dbms_application_info.set_client_info(11);

Now, we have a series of Stateless Beans that basically inject Persistence Context and execute queries (both native queries and regular POJO) and we need a way to inject the client info (that we can get from the security context) into the PersistenceContext before making calls to the EntityManager

in a nutshell I need to be able to call this..

@PersistenceContext 
EntityManager em;

@Inject
UserInfo userInfo;

public TheView getTableData(long id) {
    // At this point security Information should be set.. 
    // Call the query
    return em.find(TheView.class, id);

}

without having to call a setClientInfo() manually..

One way of doing this would probably be using interceptors and annotate the method and make the call there (providing I can get hold of the PersistenceContext that the method will use.. ).. will this even work??

Any other way of doing this??

TIA!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:22:20+00:00Added an answer on June 4, 2026 at 4:22 pm

    The interceptor approach you are writing about sounds like an excellent fit.

    I’m not 100% sure if I understood your requirements correctly, but it seems as if would be a good idea to decouple authorization logic from the actual business logic to be able to write something like this:

    …

    @IsEditor("someMoreData")
    public X getData() {
     ...
    }
    

    IsEditor is an interceptor and will encapsulate the relevant DB lookup.

    Seam Security as an independent CDI modules comes with a couple of concepts (& implementations), you should definitely check it out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on building a java web app. I've been looking to use
Friends, I am building a JAVA TCP listener, where it can handle 6000 incoming
I'm building this small java applet in which I need a JPanel which will
I'm am building a google app engine java based website. I want to allow
I'm building a Java web app that needs access to a user's Google Calendar
I am building a Java Google App Engine server project and a Java desktop
I'm currently building a Java app that could end up being run on many
I am building a Java web app, using the Play! Framework . I'm hosting
I'm building a java web media-scraping application for extracting content from a variety of
I'm building a java application which works in a LAN environment, every computer on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.