Pass userId into SessionEventListener

Since my application required to set context for VPD, I need to pass userId from web tier into SessionEventListener to store into VPD context in database. What's the correct way to do that? I tried a solution I found in this forum by using ThreadLocal. However, it is not reliable at all. Somtimes, it works, sometimes it doesn't. I also tried to put information into FacesContext.getCurrentInstance().getExternalContext().getSessionMap(). However, this will pollute my model project with UI related component. Also, when I run it in JDeveloper 11g, it always complained that ClassNotFound for FacesContext, even thought I already put Face jar file onto classpath.

That will work if all the entity managers use the same USER_ID (in fact you could specify the property in persistence.xml in that case).
However if different entity managers require different ids you need either pass the USER_ID property to emf.createEntityManager method,
or alternatively set the property directly in JPA 2.0 (Eclipselink 2.0): em.setProperty(USER_ID, userId);

Similar Messages

  • Pass parameters into SessionEventListener by using ConnectionPolicy

    Hi,
    My project is using Eclipselink/JPA with Oracle VPD. I have to pass some parameters into SessionEventListener to set up VPD context. I found couple postings in this forum talked about using ConnectionPolicy to pass in the information. Does anyone could give me a code sample about how to pass a parameter (ex. user ID) into a ConnectionPolicy? I am using JPA, so I didn't see a clear way for me to access ConnectionPolicy. Thanks!

    I used the following solution and it worked for me
    ((EntityManagerImpl)em.getDelegate()).getServerSession().getDefaultConnectionPolicy().setProperty("USER_ID", userId);
    Then in SessionEventListener, I could use clientSession to obtain "USER_ID" from connection policy.

  • How to pass parameters into Function module : CLOI_PUT_SIGN_IN_FRONT

    Hello friends,
    I am displaying values ie, amounts in the screen using write statements here i have to display the
    sign left side , i am using  Function module   'CLOI_PUT_SIGN_IN_FRONT'    
    Does anybody help me - How to pass paramter into this Function module.
    Regards,
    Phaneendra

    If you look to the code of the function module, you can see it is condensing the value.
    I would make a copy of this function, and remove the condense lines to give the result you want.
      data: text1(1) type c.
      search value for '-'.
      if sy-subrc = 0 and sy-fdpos <> 0.
        split value at '-' into value text1.
        condense value.
        concatenate '-' value into value.
      else.
        condense value.
      endif.

  • How to pass parameter into a source variable of a invoke activity

    I'm an new BPELer, I created a invoke activity to submit Oracle Appplications concurrent program, but I don't know how to pass parameter into source variable.
    BTW, I have created the mapper file (.xsl) file.
    could anyone tell me how to do that?
    Thanks,
    Victor

    Hi.
    How you start application? I think you send message to webservice(BPEL process is webservice too). So construct message with variable and value.
    But I created only processes where input value doesn't matter. I haven't use mapper yet too.

  • JRC with JavaBeans datasrc - how to pass params into javabean.getResultSet?

    Hi.
    I'm developing javabeans data sources for crystal reports for the java/JRC engine.  I've seen the document entitled Javabeans Connectivity for Crystal.  It TALKS ABOUT passing params into the methods that return java.sql.ResultSets but there is absolutely no example code anywhere that I can find on how to do it.
    What I don't understand is:  Since the JRC engine is basically controlling the instantiation of the javabean, other than calling some type of fetch method in the constructor, how the heck am I supposed to pass in db connection info and a sql string? 
    Anybody got sample code for how to call/where to call parameters that I would put in a custom getResultSet method??
    Thanks.

    I don't think that a Connection Pool class would be an ideal candidate for becoming a JavaBean. One of the most prevalent use of a JavaBean class it to use it as a data object to collect data from your presentation layer (viz. HTML form) and transfer it to your business layer. If the request parameter names match the Bean's property names, a bean can automatically get these values and initialize itself even though it has a zero argument ctor. Then a Bean could call methods in the business layer to do some processing, to persist itself etc.

  • Passing array into resultset

    hi,
    is it possible to pass an array into a resultset? if yes please indicate how.
    thank you all in advance

    Hi,
    Sorry for the confusion, here's what I'm trying to accomplish.
    I'm trying to create a report in Crystal Report and use Java as data source. My Java application needs to generate some value and pass them to the report as parameters. After some research I've found that I can use a Java Bean class as data source for Crystal Report that returns a ResultSet. Therefore I'm trying to pass some values in my Java app into the Bean class as array and convert them to a ResultSet for Crystal Report.
    If you know of a different way please let me know, otherwise, this is what I meant by passing array into resultset.
    thanks for your reply,

  • How to pass parameter into extract function (for XMLTYPE)

    I have a table PROBLEMXML with XMLTYPE field xml_column. In this column there are several deffinitions for the problem. There is no max amount of deffinitions and it can be no definition at all. I need to return all definitions for every problem as a string wirh definitions separated by ";".
    Query
    SELECT extract(prob.Def,'/Definitions/Definition[1]/@var') || ';'|| extract(prob.Def,'/Definitions/Definition[2]/@var')
    FROM PROBLEMXML j ,
    XMLTABLE (
    '/problem'
    PASSING j.xml_column
    COLUMNS probid VARCHAR (31) PATH '/problem/@id',
    Def XMLTYPE PATH '/problem/Definitions') prob
    where PROBLEM_ID =1;
    returns exactly what I want a;m.
    But
    declare
    my_var varchar2(2000) :=null;
    n1 number;
    n2 number;
    begin
    n1:=1;
    n2:=2;
    SELECT extract(prob.Def,'/Definitions/Definition[n1]/@var') || '|'|| extract(prob.Def,'/Definitions/Definition[n2]/@var') into my_var
    FROM ETL_PROBLEMXML_STG_T j ,
    XMLTABLE (
    '/problem'
    PASSING j.xml_column
    COLUMNS probid VARCHAR (31) PATH '/problem/@id',
    Def XMLTYPE PATH '/problem/Definitions') prob
    where PROBLEM_ID =1;
    dbms_output.put_line(my_var);
    end;
    returns NULL.
    Is there is a way to pass parameter into extract function?

    I need to return all definitions for every problem as a string wirh definitions separated by ";".In XQuery, there's the handy function "string-join" for that.
    For example :
    SQL> WITH etl_problemxml_stg_t AS (
      2   SELECT 1 problem_id,
      3  xmltype('<problem id="1">
      4   <Definitions>
      5    <Definition var="var1"></Definition>
      6    <Definition var="var2"></Definition>
      7    <Definition var="var3"></Definition>
      8   </Definitions>
      9  </problem>') xml_column
    10   FROM dual
    11  )
    12  SELECT j.problem_id,
    13         prob.probid,
    14         prob.def
    15  FROM etl_problemxml_stg_t j,
    16       XMLTable(
    17        'for $i in /problem
    18         return element r
    19         {
    20          $i/@id,
    21          element d { string-join($i/Definitions/Definition/@var, ";") }
    22         }'
    23        passing j.xml_column
    24        columns
    25         probid varchar2(30)  path '@id',
    26         def    varchar2(100) path 'd'
    27       ) prob
    28  ;
    PROBLEM_ID PROBID               DEF
             1 1                    var1;var2;var3

  • How to pass parameter into transaction iview ?

    Hi experts,
    I want to know "how to pass parameter into transaction iview ".
    Regards,
    Krishna Balaji T

    Hi Krishna,
    Not sure if this can help you.
    1) Passing a parameter to a transaction iview (I saw a resolved suggestion)
    Passing a parameter to a transaction iview
    2) Passing a parameter from the portal to R3 (helpful info for you)
    Passing a parameter from the portal to R3
    3) Create SAP Transaction iView using SAPGUI for Windows (Great Blog and info about TA Iview)
    Create SAP Transaction iView using SAPGUI for Windows
    Please check the following link for Transaction Iviews
    http://help.sap.com/saphelp_nw2004s/helpdata/en/02/f9e1ac7da0ee4587d79e8de7584966/frameset.htm
    Just some info: Portal is basically what the end user can see. What he can do, is still maintain in the backend system. If there are parameters setup already for the user in the backend system (in SU01), then those parameters should still valid for the transaction that the parameters are linked to.
    Hope that helps and award points for helpful suggestions.
    Ray

  • Deferred Tasks - Passing Variables into Workflow

    Hi everyone
    I am experiencing difficulties with deferred tasks in IDM 8.1. I have managed to create a deferred task on a user, with the task name being ‘Generate Email’. I also passed in an attribute ‘id’, and these can be seen in the user view under waveset.properties.tasks.
      <Activity id='1' name='Add Deferred Task'>
                    <Action id='1' application='com.waveset.session.WorkflowServices'>
                        <Argument name='op' value='addDeferredTask'/>
                        <Argument name='type' value='User'/>
                        <Argument name='name'>
                            <ref>accountId</ref>
                        </Argument>
                        <Argument name='authorized' value='true'/>
                        <Argument name='subject'>
                            <s>Configurator</s>
                        </Argument>
                        <Argument name='task'>
                            <ref>taskToAdd</ref>
                        </Argument>
                        <Argument name='date'>
                            <new class='java.util.Date'/>
                        </Argument>
                        <Argument name='owner'>
                            <ref>WF_CASE_OWNER</ref>
                        </Argument>
                        <Argument name='taskDefinition'>
                            <new class='com.waveset.object.GenericObject'>
                                <map>
                                    <s>id</s>
                                    <ref>accountId</ref>
                                </map>
                            </new>
                        </Argument>
                    </Action>
                </Activity>I have set up a scheduler that correctly scans all the user objects for this workflow name, and the ‘Generate Email’ workflow is periodically run.
    The problem is when it gets to the Generate Email workflow, all the variables that were set when the deferred task was created are gone. Both <ref>id</ref> and <Variable name=’id’ input=’true’/> return null.
    Setting the following in the TaskSchedule object did not help, as the string value $(id) is passed into the workflow instead of the id itself. I cannot debug the TaskSchedule as the Netbeans IDE does not allow me to put in breakpoints on this file.
    <Variables>
        <Object>
          <Attribute name='id' value='$(id)'/>
        </Object>
      </Variables>My question is, how do I pass variables into a workflow via a deferred task?

    Hi,
    Here is an example that I found that may assist.
    <Activity name='setDefTask'>
         <Action application='com.waveset.session.WorkflowServices'>
           <Argument name='op' value='addDeferredTask'/>
           <Argument name='name' value='$(user)'/>
           <Argument name='task' value='$(taskType)'/>
           <Argument name='date' value='$(date)'/>
           <Argument name='description' value='$(taskDescription)'/>
           <Argument name='taskDefinition'>
              <Object>
                  <Attribute name='Arg1' value='value1'/>
                  <Attribute name='Arg2' value='value2'/>
                  <Attribute name='Arg3' value='value3'/>
              </Object>
           </Argument>
         </Action>
         <Transition to='end'/>
    </Activity>Hope it helps

  • Why I can't pass parameters into CR from VB6

    I want to Pass parameters into crystal report from VB6.
    But whatever I try, it don't work Fine,
    always Show the message "This field name is not known".
    Crystal Report::
    Parameter: a.@cmpy;
                       b.@p1
    formula:
    a. If {?@cmpy} ="USA" or {?@cmpy} ="usa" then
          "This is test 1 sentences"
       else if {?@cmpy}="TWD" or {?@cmpy} = "twd"  then
          "This is test 2 sentences"
    b. if trim({?@p1})="1" then "This is test 3 sentences"  
    VB::
    Public oApp As New CRAXDDRT.Application
    Public oRpt As CRAXDDRT.Report
    oRpt.ParameterFields(1).ClearCurrentValueAndRange
    oRpt.ParameterFields(2).ClearCurrentValueAndRange
    oRpt.ParameterFields(1).AddCurrentValue ("TWD")
    oRpt.ParameterFields(2).AddCurrentValue ("1")  
    I had trid to use "IsCurrentValueSet" function to check whether parameter was set or not, and It responsed "Ture",so I so confused about it.
    Anyone know about this??
    ps. I had trid other way that change the formula indirectly, although it can work fine, but it isn't a right way to solve my problem.
    Edited by: DeanLai on Jun 22, 2010 8:54 AM

    I Find something.
    First I tried to add parameter and wanted to see these value on Report.
    So I inserted {?@cmpy} and {?@p1} into report, and used VB code
    "oRpt.ParameterFields(1).AddCurrentValue ("TWD")" and "oRpt.ParameterFields(2).AddCurrentValue ("1")",
    then ran the process, but it didn't display any value on report,
    so why it couldn't pass value into parameter??
    then I tried other way which was to add new parameter, and used the same way to pass
    value into parameter, then it can display value on report.
    So the different between these is {?@cmpy} and {?@p1} which come from
    Stores Procedure.
    While I set Database in crystal report, set all value into Store Procedure's
    parameter(the window about "Enter Parameter Values"), then it automatic come out the DB columns and parameter(SP parameter)
    , course include {?@cmpy} and {?@p1}.
    Do this problem cause my question?
    Can we pass value into parameter which come from SP parameter??
    Can we use these parameter into forumla??
    Edited by: DeanLai on Jun 30, 2010 11:56 AM

  • Passing parameters into an URL Services portlet

    Hi,
    is there any way to pass parameters into an URL Services portlet ? I want to give the user the ability to set a preference for which sections of an XML file should be displayed. The preference should be passed into the XMLFilter which should add these parameters as XSLT variables to the stylesheet. Is this possible ?
    Cheers,
    Ernst

    As of now we do not have provision to pass parameters to the portlet dynamically. However, if required, at most could be used is headerTrim tag and footerTrim tag. If you want to discard some data from mid of the file, its not supported.
    bye
    Baig
    null

  • Pass parameters into CellRenderer

    Hello!
    I want to pass parameters into CellRenderer.
    How can I do that?

    Found solution!
    Create method, that set my Bean in CellRenderer, in what I keep my values, and call this method when create my CellRenderer. Than Use MyBean inside CellRenderer when it render cell.
    JSP:
    <hbj:tableView id="NewTable" model="LotsBean.ModelLots"
              design="TRANSPARENT"
              headerVisible="false"
              footerVisible="false"
              fillUpEmptyRows="false"
              selectionMode="NONE"
              visibleFirstRow="1"
              rowCount="16"
              width="100%" >
              <%  MyCellRenderer MyCell = new MyCellRenderer();
                     MyCell.setST(MyBean);
                     NewTable.setUserTypeCellRenderer(MyCell); %>
         </hbj:tableView>
    CellRenderer class:
         public void setST(user_registration_bean Bean){
              MyBean = Bean;

  • How to passing value into Captivate from html?

    How to passing value into Captivate from html?
    Or
    How to communicate between objects in one slides?

    Hi czhao0378 and welcome to the forums!
    Captivate does not natively allow you to communicate your own
    data, either internally or externally. The only way to make this
    happen is to create your own functionality, either via custom-built
    Flash objects or JavaScript code executed in the browser or a
    combination of both.
    The only example I've seen of any "data passing" inside
    Captivate is a custom text input/output solution that was posted on
    the Captivate Developer Exchange:
    http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1253 021
    This solution consists of an input box that takes information
    from the user on one slide and a second box that displays that
    information on another slide. The functionality was built in Flash
    and is embedded in Captivate as a Flash "animation". Unfortunately,
    since this is a custom functionality, the information is not
    included in the user completion results Captivate can pass to a
    Learning Management System.
    Since the solution mentioned above relies on a Flash
    Actionscript variable to hold the information that is displayed,
    you can also pass the information from HTML to Captivate using the
    "SetVariable" command in JavaScript. This would at least allow you
    to display your own HTML-based data inside Captivate.
    Beyond that, I'm not aware of any other way to gather and
    pass data in Captivate.

  • I can't pass photos into my ipod!

    I try to pass pictures into my ipod by clicking options, photos, and then choose from where to sincronize my pictures. I choose a folder that I'm sure is smaller than the space left in my ipod and still it won't work... the ipod says its synchronizing but the number of pictures in my ipod remains 0.

    Hi Monica,
    Welcome to Apple Discussions
    There seems to be a lot of problem loading photos onto iPod, as you will find if you do a search in Search Discussions.
    Can you do a restore (Restoring iPod to factory settings) first to clear everything off your iPod.
    Next try syncing just the photos only to prove that they will load to the nano.
    The problem seems to be that the nano needs more space then the total amount required by photos.
    If that doesn't fix it we'll have a look at some other stuff.
    Regards,
    Colin R.

  • Project PSI API checkoutproject is causing exception :LastError=CICOCheckedOutToOtherUser Instructions: Pass this into PSClientError constructor to access all error information

    Hi,
    I'm trying to add a value to the project custom field. After that I'm calling the checkout function before the queueupdate and queuepublish. While calling the checkout  the program is throwing exception as follow:
    The exception is as follows: ProjectServerError(s) LastError=CICOCheckedOutToOtherUser Instructions: Pass this into PSClientError constructor to access all error information
    Please help me to resolve this issue.  I have also tried the ReaProjectentity method i nthe PSI service inrodr to find that project is checked out or not  . Still  the issue is remains . Anyone please help me for this
    flagCheckout = IsProjectCheckedOut(myProjectId);
                        if (!flagCheckout)
                            eventLog.WriteEntry("Inside the updatedata== true and value of the checkout is " + flagCheckout);
                            projectClient.CheckOutProject(myProjectId, sessionId, "custom field update checkout");
    Regards,
    Sabitha

    Standard Information:PSI Entry Point:
    Project User: Service account
    Correlation Id: 7ded1694-35d9-487d-bc1b-c2e8557a2170
    PWA Site URL: httpservername.name/PWA
    SSP Name: Project Server Service Application
    PSError: GeneralQueueCorrelationBlocked (26005)
    Operation could not completed since the Queue Correlated Job Group is blocked. Correlated Job Group ID is: a9dda7f4-fc78-4b6f-ace6-13dddcf784c5. The job ID of the affected job is: 7768f60d-5fe8-4184-b80d-cbab271e38e1. The job type of the affected job is:
    ProjectCheckIn. You can recover from the situation by unblocking or cancelling the blocked job. To do that, go to PWA, navigate to 'Server Settings -> Manage Queue Jobs', go to 'Filter Type' section, choose 'By ID', enter the 'Job Group ID' mentioned in
    this error and click the 'Refresh Status' button at the bottom of the page. In the resulting set of jobs, click on the 'Error' column link to see more details about why the job has failed and blocked the Correlated Job Group. For more troubleshooting you can
    look at the trace log also. Once you have corrected the cause of the error, select the affected job and click on the 'Retry Jobs' or 'Cancel Jobs' button at the bottom of the page.
    This is the error I'm getting now while currently calling the forcehckin, checkout and update. Earlier it was not logging any errors.From this I'm not able to resolve as i cannot filter with job guid

Maybe you are looking for

  • Unknown sync error -- Tried everything (?)

    I've recently switched from Chrome to Firefox to try and get as far away from Google as possible. There, I never had any issues with syncing across devices and platforms. On my Windows desktop, syncing never fails. On my MacBook Air, it always says,

  • To have one or two environments for sap bpc 10

          Hi all,      My company has implemented the model the Planning, now want to implement the model Consolidation,      my question is if it is better have everything in the same environment or have an environment for planning and other for consoli

  • Aperture with new iOS iPhoto App

    Is there any reason to get the new iPhoto application if using Aperture on my mac? Does it offer any viewing advantages on iPad/iPhone over the standard photos app? Can you even sync from Aperture to it? Grateful for any experiences.

  • Trying to add an imovie to iDVD and it won't let me!!! HELP!

    HI! I Hope someone can help me soon! We have a project due tomorrow morning. This is an iMovie we made and have burned before by making a disc image in iDVD and and then burning. We made several modifications. I renamed the movie and now I want to ma

  • BIN to BIN transaction error

    Hi experts,      Recently I've received an error "1250000017 - Receipt warehouse cannot be identical to the release warehouse." in Bin to Bin transfer. Have you encounter this one? Can't find similar post with this. Regards,