Passing dynamic argument in Named Query

I created a class Zoneclass.java in which i defined the toplink mappings of attributes for a table viz. zone.
Now i created a named query as q1 which require a runtime argument arg1.
Basically the query wants to say "select * from Zone(or zoneclass) where zonename='arg1' ." this arg1 should be taken from a textfield for search criteria.
Now when i created the Data Control Pallete of this class and q1(String) is generated in Data Control Pallete.
Now finally i want to use this q1(String) from Data control Pallete on a UIX page .
I will drag it as read only table in a UIX page but it dosen't works bcoz the parameter is not passed so how and where i can pass that argument so that before coming to the tabledata, this query will fire with this argument.
Regards
Somvir

I created a class Zoneclass.java in which i defined the toplink mappings of attributes for a table viz. zone.
Now i created a named query as q1 which require a runtime argument arg1.
Basically the query wants to say "select * from Zone(or zoneclass) where zonename='arg1' ." this arg1 should be taken from a textfield for search criteria.
Now when i created the Data Control Pallete of this class and q1(String) is generated in Data Control Pallete.
Now finally i want to use this q1(String) from Data control Pallete on a UIX page .
I will drag it as read only table in a UIX page but it dosen't works bcoz the parameter is not passed so how and where i can pass that argument so that before coming to the tabledata, this query will fire with this argument.
Regards
Somvir

Similar Messages

  • Pass dynamic values to search-query in wlp-syndication-config for RSS

    Hi All,
    I want to pass dynamic values to the <search-query> element for the <syndication-feed> node in the wlp-syndication-config.xml file for implementing RSS feeds.
    Here's a sample
    <syndication-feed>
              <name>RSSFeed</name>
              <search-query>cm_objectClassInstance=='Node' &amp;&amp; date == 'x'_</search-query>
              <search-type>pubmeta</search-type>
         </syndication-feed>
    I tried passing the parameter in the url but the feed doesn't read it. The only option i have is to manually put the value to get the content from the repository, which sucks...because the values can change any time. is there any way that I can avoid it
    Any help on this would be appreciated.
    Thanks,
    K

    James:
    Passing filters to an IR within the URL is described here
    http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/app_comp.htm#sthref989
    Varad

  • Passing an argument in the SQL Query of a View Object

    Hi,
    It is possible that this question has been asked before, however I have searched for a half an hour in the forums and couldn't find a solution.
    I am also new to using JDeveloper and ADF. Here's the situation:
    I am developing an application that doesn't have to do anything else then displaying data from a database. Pretty straightforward actually.
    Now I have made a vew pages with several collapsible panels (af:showDetailHeader) and have setup the datasources (or so I thought).
    All that remains is:
    - drag & drop a view object, from the application module that I created, onto the collabsible panels, so a child element gets created which displays data from the database.
    - hack the layout so it looks like I want it to.
    The problem that I have is the following:
    I am using a 'User'-class that contains values I need when quering the database.
    That User-object is part of a user-session.
    What I want, for example, is to use the 'getPersonId()' function of that User-object and pass the argument to a SQL-query of a certain view-object.
    The query would become something like:
    'SELECT * FROM people WHERE people.personId = :someNumber'.
    Now I've read some stuff about variable binding, which is complemented by something like (backing bean code):
    getDBTransaction().getRootApplicationModule().getACertainViewObject().setWhereClauseParameter(1, user.getPersonId());
    The examples I have found that might match my wishes are not using business components, but EJB's. I am having difficulty with understanding the 'how'-part of variable binding.
    Also, I do not know enough of ADF to be able to create a situation like:
    'User loads page, collapsible panel 1 is fully shown, the others are undisclosed.'
    (meaning, that for panel1 a query has been executed.)
    'User clicks on collapsible panel 2 which triggers a backingbean that somehow retrieves data from a view object'.
    I would appreciate any help that somebody can give.
    If it is not too much of a problem, please provide code snippets in case you have a solution. I am new to ADF :(.
    -edit
    I am using JDeveloper 10.1.3.3.0 in case that is of any importance.
    Message was edited by:
    Hugo Boog

    Hello Stijn,
    I didn't think about a referenced bean rule in the faces-config.
    I added it right away and I am now able to set parameters of a View-object, not using a page button and before the page loads. You made my day!
    In case anyone ever reads this post again, the summary of how to generate a table based on a View-object using dynamic parameters.:
    1a: Go to faces-config.xml -> Overview tab'
    1b: Go to the menuitem "Referenced Beans"
    1c: Click on 'new' and select the existing bean you want to access data from and input a name. In this example I use name="user"
    2: Create a View-object using the wizard.
    2a: Specify the query you want in the menuitem 'SQL Statement'.
    Add the 'parameters' you want to. You will have something like:
    "SELECT * FROM someTable WHERE table.columnname LIKE :someArgument".
    - hint: if you want the result to become something like:
    "SELECT * FROM someTable WHERE table.columnname LIKE '%someArgument%'" then you have to add the '%'-characters in your code itself (read: someClass.setParameter("%" + someArgument);).
    2b: In the menuitem 'Bind Variables' you have to add the variables you are referring to in the query. If you look at the query in 2a, then you have to add a variable with name "someArgument".
    2c: Add the View-object to a Application Module (create one if nessecairy).
    3a: Open a .jsp(x) file. Drag the View-object created in step 2 from the 'Data Controls'-pane to the page.
    3b: Click on the '+' of the View-object in the 'Data Controls'-pane and open 'Operations' and drag 'ExecuteWithParams' to your page as a button.
    3c: We do not want to use a button, the action has to be executed immediatly. So In the page source remove the lines that were created after dropping 'ExecuteWithParams'.
    3d: Right-click on the page and select "Go to Page Definition".
    3e: Go to the action id that is called 'ExecuteWithParams#', where # is a number.
    Change the id to something useful.
    3f: Change the NDValue so it corresponds with the value you want.
    Example:
    <action id="getAddressData" IterBinding="AddressesView1Iterator"
    InstanceName="MyHRServiceModuleDataControl.AddressView1"
    DataControl="MyHRServiceModuleDataControl" RequiresUpdateModel="true" Action="95">
    <NamedData NDName="someArgument" NDType="java.lang.String"
    NDValue="#{user.personId}"/>
    </action>
    Note: It is possible to use the value of a Backing Bean in NDValue.
    Note 2: user is the bean I referred to in the faces-config.xml!
    3g: Under the executables item, add an 'invokeAction' to pass the parameter to the View-object before your JSP-file loads:
    <executables>
    <invokeAction Binds="getAddressData"
    id="loadAddressDataOfPersonIdInSession"
    Refresh="prepareModel"/>
    Thank Stijn Haus for this :)

  • Passing an array of objects to a named query

    I'm trying to use a named query that will have a
    in() expression operator (clause) to retrieve a set of objects.
    The in() operator requires an array of objects to pass in.
    Specifically I want to pass an array of BigDecimal of unknown size.
    The query looks like that:
    ExpressionBuilder seq = new ExpressionBuilder();
    Expression exp = seq.get("id").in(keys);
    ReadAllQuery query = new ReadAllQuery();
    query.setReferenceClass(RegistrationNumberSequencer.class);
    query.addArgument("keys");
    query.setSelectionCriteria(exp);
    And the "keys" would be:
    Object[] keys = new Object[2];
    keys[0]= new BigDecimal(1);
    keys[1]= new BigDecimal(2);
    I have got a conversion exception(Could not convert to BigDecimal class) when executing the query.
    Can I pass this array as a parameter somehow ?
    Thanks a lot
    Ovidiu

    Hi Ovidiu,
    My apologies for the missed code. You need to pass the vector of elements into another vector, so TopLink will interpret the single element of the second vector as the correct query argument, and expend the elements in the first vector into the IN clause.
    The named query defined I sent in previous mail is still correct, but you need to pass in the argument like:
    Vector keys = new Vector();
    keys.addElement(new BigDecimal(1));
    keys.addElement(new BigDecimal(2));
    Vector arg = new Vector(1);
    arg.addElement(keys);
    Now you can pass the arg in when executing the query, and should get the correct result.
    To stand my claim, I did a mini test using our TopLink Employee demo and here is the generated SQL:
    Call:SELECT t0.VERSION, t1.EMP_ID, t0.L_NAME, t0.F_NAME, t1.SALARY, t0.EMP_ID, t0.GENDER, t0.END_DATE, t0.START_DATE, t0.MANAGER_ID, t0.START_TIME, t0.END_TIME, t0.ADDR_ID FROM EMPLOYEE t0, SALARY t1 WHERE ((t0.EMP_ID IN (1, 2)) AND (t1.EMP_ID = t0.EMP_ID))
    You can see the IN clause in generated as expected!
    As Doug said, we do not officially support array as query argument yet. I would use the proper way to build the query.
    King

  • Dynamically passing the values to IN query in JDBC

    Hi,
    I have a list which contains a single or multiple values which does have CustomerVO as a generic.Here i need to iterate the list pass these values to "IN" query.
    These should happen dynamically, as we dont know whether the list will hold a single or multiple value. If the list.size ==1 , then it contains a single value in it. Hence there is no need for a comma(,) in the IN query else we need to have it, like .... IN (Aaron,Bob). Please help me in this?
    Thanks.

    797836 wrote:
    I have a list which contains a single or multiple values which does have CustomerVO as a generic.Here i need to iterate the list pass these values to "IN" query.
    These should happen dynamically, as we dont know whether the list will hold a single or multiple value. If the list.size ==1 , then it contains a single value in it. Hence there is no need for a comma(,) in the IN query else we need to have it, like .... IN (Aaron,Bob).So basically you need to output the List (capital 'L') as a comma-delimited list (small 'l').
    The procedure for that is usually something like:
    1. Output the first element.
    2. For any further elements:
    2a. Output ","
    2b. Output the element.
    Winston

  • How to pass the arguments dynamically to a Oracle procedure.

    Hi all..
    How to pass the arguments dynamically to a procedure.
    Thanks in Advance.

    I have a concurremt program which has 5 parameters right now. The user can add more parameters from front end as per their requirement.
    So that time.. the 6th parameter has to add to my procedure dynamically.
    Thanks.

  • Named query gives a null argument exception in JPQL

    Hi all,
    I need your help with a named query which i have which returns a org.apache.openjpa.persistence.ArgumentException: null .
    Here is my named query:
    @NamedQuery(name="user_deactivateUser", query="update UserImpl u SET u.bisdeleted=1,u.dtupdatedate=SYSDATE, u.dtdeletedate=SYSDATE where u.nID=?1" Now when i call this query in my method it gives an null pointer exception at q.executeUpdate().
    public void doDeactivateAllUsers(int userID) throws ServiceException{
      EntityManager em = null;
      em = BaseDAO.getEntityManager();
      Query q = em.createNamedQuery("user_deactivateUser");
                   q.setParameter(1,userID);
                   int count = q.executeUpdate();here is the full stack trace of this exception.
    <openjpa-1.2.1-r752877:753278 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: null
         at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:814)
         at org.apache.openjpa.kernel.QueryImpl.updateAll(QueryImpl.java:884)
         at org.apache.openjpa.kernel.DelegatingQuery.updateAll(DelegatingQuery.java:573)
         at org.apache.openjpa.persistence.QueryImpl.executeUpdate(QueryImpl.java:336)
         at com.forrester.companyadmin.service.DeactivateUserService.doDeactivateUser(DeactivateUserService.java:98)
         at com.forrester.companyadmin.service.DeactivateUserService.doDeactivateAllUsers(DeactivateUserService.java:225)
         at com.forrester.companyadmin.controller.DeactivateUsersController.action(DeactivateUsersController.java:376)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         at javax.faces.component.UICommand.broadcast(UICommand.java:325)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at com.forrester.companyadmin.filters.CompanyAdminFilter.doFilter(CompanyAdminFilter.java:102)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
         at java.lang.Thread.run(Unknown Source).
    Can someone let me know if there is anything wrong in the way iam passing these parameteres
    Edited by: user8769643 on Mar 19, 2010 7:37 AM

    i got this working. I am passing dtupdate=SYSDATE which is incorrect. i added one more parameter "q.setParameter(3,new java.util.Date())" to pass today's date and it worked.
    Thanks

  • Pass dynamic Command line arguments

    Hi,
    I tried to pass dynamic command line argument to Web start using the method :
    "javaws URL -D foo -D bar"
    as explained in the "Unofficial JWS/JNLP FAQ" that " You can pass your own system properties to your app using -D switch ....", but I got the following error at the start;
    error occurred while launching/running the application.
    Category: Invalid Argument error
    Too many arguments supplied: {http://...URL/my.jnlp, -Did=123 }
    p.s. I already added the"<property name='' value=''/> in the <resourse>, and modified the main class to get the parameter using System. getProperty();
    Did anyone try to this method before? What's wrong of this?
    Thanks in advance for your help.

    Thanks.
    here below is the jnlp file:
    <jnlp spec="1.0+" href="$$name" codebase="$$codebase">
    <information>
    <title>GUI Application</title>
    <vendor>PS</vendor>
    <description>PS GUI WebStart Version</description>
    <icon href="logo.jpg" />
    <offline-allowed />
    </information>
    <resources>
    <j2se version="1.3" />
    <jar href="lib/gui.jar" />
    <property name="id" value="zbc" />
    <jar href="lib/classes12.zip" />
    <jar href="lib/j2ee.jar" />
    <jar href="lib/jaas.jar" />
    <jar href="lib/jce1_2_1.jar" />
    <jar href="lib/jdom.jar" />
    <jar href="lib/xerces.jar" />
    <jar href="lib/local_policy.jar" />
    <jar href="lib/log4j.jar" />
    <jar href="lib/orion.jar" />
    <jar href="lib/sunjce_provider.jar" />
    <jar href="lib/US_export_policy.jar" />
    </resources>
    <security>
    <all-permissions />
    </security>
    <application-desc main-class="GUIFrame">
    </application-desc>
    and in the main class "GUIFrame", i use System.getProperty("id") t get the parameter, if I hardcode the value of the "id" in this jnlp file and use javaws URL, everything's fine, but not the "javaws URL -Did=value" which will return the error as mentioned.
    Thanks again for your help.

  • IN operator in Named Query

    hi all,
    is it possible to create a named query containing the IN clause if yes how to pass the parameters , i have smth like that:
    "select * from tblUsers where employee_number in #param"
    what should be the type of the parameter?

    You can create a named query using an IN parameter, but you should be careful in doing this as an IN collection is not a valid parameter in SQL. TopLink will handle translating the IN as long as you are using dynamic SQL, or disable the prepare on the query. You can use Vector as the parameter value.
    i.e.
    ReadAllQuery query = new ReadAllQuery(Employee.class);
    query.setSQLString("select * from tblUsers where employee_number in #param");
    // Or: query.setSelectionCriteria(query.getExpressionBuilder().get("number").in(query.getExpressionBuilder().getParameter("param")));
    query.setShouldPrepare(false);
    query.addArgument("param");
    Vector args = new Vector();
    Vector param = new Vector();
    param.add(new Integer(1));
    param.add(new Integer(2));
    param.add(new Integer(3));
    args.add(param);
    session.executeQuery(query, args);
    // Or: session.executeQuery("findAllWithNumbers", Employee.class, args);

  • Named Query Error

    Hi,
    I'm having trouble passing argument to a named query in the mapping workbench.
    Here is my SQL:
    SELECT COUNT(*) FROM VALID_PARTY_CLASSIF, CLASSIF_TYPE WHERE CLASSIF_TYPE.CLASSIF_TYPE_ID = VALID_PARTY_CLASSIF.CLASSIF_TYPE_ID AND CLASSIF_TYPE.CLASSIF_TYPE_ID = #ID
    and when I find and execute the query, getting following error
    Execute query ReadObjectQuery(com.amgen.bria.business.bizobject.ClassificationTypeBO)
    SELECT COUNT(*) FROM VALID_PARTY_CLASSIF, CLASSIF_TYPE WHERE CLASSIF_TYPE.CLASSIF_TYPE_ID = VALID_PARTY_CLASSIF.CLASSIF_TYPE_ID AND CLASSIF_TYPE.CLASSIF_TYPE_ID = ?
         bind => [56]
    Exception [TOPLINK-6044] (OracleAS TopLink - 10g (9.0.4) (Build 031018)): oracle.toplink.exceptions.QueryException
    Exception Description: The primary key read from the row [DatabaseRow(
         => 0)] during the execution of the query was detected to be null. Primary keys must not contain null.
    Query: ReadObjectQuery(com.amgen.bria.business.bizobject.ClassificationTypeBO)Local Exception Stack:
    Exception [TOPLINK-6044] (OracleAS TopLink - 10g (9.0.4) (Build 031018)): oracle.toplink.exceptions.QueryException
    Exception Description: The primary key read from the row [DatabaseRow(
         => 0)] during the execution of the query was detected to be null. Primary keys must not contain null.
    Query: ReadObjectQuery(com.amgen.bria.business.bizobject.ClassificationTypeBO)
         at oracle.toplink.exceptions.QueryException.nullPrimaryKeyInBuildingObject(QueryException.java:541)
         at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:262)
         at oracle.toplink.queryframework.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:226)
         at oracle.toplink.queryframework.ReadObjectQuery.execute(ReadObjectQuery.java:344)
         at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:498)
         at oracle.toplink.queryframework.ReadQuery.execute(ReadQuery.java:111)
         at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:1968)
         at oracle.toplink.threetier.ServerSession.internalExecuteQuery(ServerSession.java:629)
         at oracle.toplink.threetier.ClientSession.internalExecuteQuery(ClientSession.java:392)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1096)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1065)
         at oracle.toplink.publicinterface.Session.executeQuery(Session.java:966)
         at com.amgen.bria.persistence.module.toplink.TopLinkPersistenceService.internalExecuteQuery(TopLinkPersistenceService.java:137)
         at com.amgen.bria.persistence.PersistenceService.executeQuery(PersistenceService.java:97)
         at com.amgen.cma.persistence.service.ClassificationPersistenceService.findCustomerForClassifTypeCount(ClassificationPersistenceService.java:405)
         at com.amgen.cma.persistence.service.ClassificationPersistenceServiceTest.testFindCustomerForClassifTypeCount(ClassificationPersistenceServiceTest.java:193)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
    client released
    Please let me know if I am missing anything.
    Thanks
    Saket

    Saket, the problem is right here:
    ReadObjectQuery(com.amgen.bria.business.bizobject.Clas
    ificationTypeBO)
    When you read a an object mapping back, the primary key you have specified for that object mapping in Toplink has to be part of this search criteria (it is how it's stored in toplink's identity map/cache)
    Since you are only executing a 'select count(*)', it is erroring out
    HTH,
    Sean

  • Passing dynamic parameters to an IR Report

    Hello,
    We have installed Hyperion BI+ 9.3.1. We are in the process of evaluating the development of IR reports which would
    have a requirement to have parameters passed dynamically. For example, we'd be interested in passing a date as a parameter which then would be used by the query inside IR to filter/bring back data from the database pertinent to the date being passed.
    The need for this is because once developed we want to execute the IR on a weekly basis whereby the date keeps moving forward to be then used to extract relevent data.
    Any thoughts on how this can be done? Also, on a related note are there any backend command line utilities or interfaces that can be used to pass the parameter dynamically to the IR report?
    Thanks in advance
    Rajesh

    Doug,
    Thanks for the response. The delivery of the report output would be via Workspace (iHTML). I mentioned date parameter as an example. The report or reports may need to accept other paramaters as well - like department id or product. While the number of parameters and the nature of the parameters would be known ahead of time the value would need to be derived dynamically (by say reading a database table containing transactional data)
    As for the command line utility, I am thinking more along the lines of say Oracle Reports which enables you to invoke a run-time command (rwcli60 for example) and pass the necessary arguments to the report.
    I have seen the sample java programs that are shipped with the product (and we have used one of them called AddBqy) but haven't seen one that enables passing dynamic parameters.
    I will look into the SmartCut option as recommended by you.
    Any more insights/suggestions will be greatly appreciated.
    Thanks
    Rajesh

  • Creating a Java named query?

    Hi,
    From the application developers manual; is it implied that named queries can be created using the Oracle Toplink API in Java; i.e out of the workbench but I have not been able to find any references to this elsewhere. Does anyone have any information on this? i.e creating the named query in Java code and then adding it to the project deployment.
    In addition, is it possible to have it such that if a named query expects 4 arguments; the Java code is written to check if there are any null values passed in, and if the values are null those columns wlil be removed from the query.

    There are really two types of queries that apply.
    Named queries being those queries defined in Java code at application start up that take a fixed number and types of parameters. These queries are typically added using descriptor after-load methods. In the MW you select the static after-load method where you wish to define your queries. As of TopLink 9.0.4 it is possible to define your named queries with arguments directly in the MW without an after-load method.
    Redirect queries are queries where TopLink invokes your method at runtime to execute the query. This approach allows for your code to selectively build the where clause based upon the arguments passed in.
    Some links into the docs that may be of interest:
    after-load: http://download-west.oracle.com/docs/cd/B10464_01/web.904/b10316/dscriptr.htm#1014978
    Using named queries: http://download-west.oracle.com/docs/cd/B10464_01/web.904/b10313/queries.htm#1146839
    Redirect queries: http://download-west.oracle.com/docs/cd/B10464_01/web.904/b10313/queries.htm#1141580
    Doug

  • Native TopLink named query with named parameters

    Hello,
    Defining my metadata in native TopLink xml and using the native TopLink's Session interface I can access and successfully execute a named query using positional parameters (parameters passed to match the ?1 ?2 etc). I used for this the Session.executeQuery(String, Class, List) method e.g.
    select p from Person p where p.name = ?1
    Now, how can I get the same Session to execute named queries using named parameters? None of the Session.executeQuery methods seem suitable ... Am I missing anything here? e.g.
    select p from Person p where p.age = :age
    I can't find in Session http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/b13698/oracle/toplink/sessions/Session.html a good match for this use-case. I would expect something like:
    Session.executeQuery(String queryName, Class target, List argNames, List argValues)
    or
    Session.executeQuery(String queryName, Class target, Map argsKeyedByName)
    but can't find any good match, can anyone please enlighten me?
    Thanks in advance,
    Best regards,
    Giovanni

    Hello Chris,
    Many thanks for your response. I am sorry if I did not explain my problem properly.
    Suppose I already defined a named query in the metadata XXXProject.xml using the <opm:querying ... this JPQL named query "customFinder" already exists and would look something like:
    select p from Person p where p.firstname=:firstname and p.lastname=:lastname and p.birthdate=:birthdate
    now say you want to execute this query from the Session:
    Vector args = new Vector();
    // how do you know the order? you shouldn't know the order!
    // you know only the parameter names and that's what I mean
    // about named parameters
    // This args setup is wrong ... I need a way to specify to which
    // parameter name each argument corresponds to. In other words
    // if the named query where criteria order of parameters is modified
    // perhaps because of pruning composite keys etc you won't break the
    // existing code ...
    args.add(new Date());
    args.add("Azua");
    args.add("Giovanni");
    Session session = ...
    session.executeQuery("customFinder", Person.class, args);
    JPA supports both type of queries positional parameters and named parameters. Your explanation above is only for the first, my question refers to the later.
    I have not yet found the api for this ... though I am investigating along the lines of:
    Query query = session.getQuery("customFinder");
    and then try to assign the arguments in the same order that the parameters are defined in query or?
    Thanks in advance,
    Best regards,
    Giovanni
    Edited by: bravegag on 29.05.2009 08:06

  • Named Query / MaxRows-Value as Parameter?

    Hello!
    Í'm using Toplink 10.1.2 with named queries.
    How can I set "maxRows" as additional parameter for a named query?
    eg.
    ReadAllQuery raq = new ReadAllQuery(MyBean.class);
    ExpressionBuilder eb = new ExpressionBuilder();
    raq.addArgument("searchString")
    raq.setMaxRows( ... ) ==> should be an int - value.
    regards
    Harald.

    Query arguments can only be used in the selection criteria, not as maxRows or other query properties.
    It may be best to use a dynamic query for this operation, or define multiple named queries for the query with different maxRow options if there are a fixed amount.
    You can also define a QueryRedirector on the named query to allow execution of a dynamic query in place of the name query.

  • TopLink ADF binding named query parameterised

    Repost from JDEV forum
    What is the easieast way to execute parameterised named queries using TopLink and ADF databinding?
    Better yet what would be the best practice to combine parametrised named queries with ADF data binding/controls. Data Binding Primer document is geared mostly towards BC rather than TopLink, any similar docs for TopLink that would have detailed "HowTo's" ? Application Developer Guide does not mention binding/controls.
    Thanks.

    The easiest way is to define a query on the model object (e.g. Employee) and then regenerate the toplink deployment descriptor and the datacontrol.
    This should expose the new query to the Datacontrol pallete. You can then use drag and drop to use the new query on the jsp/struts etc.
    If you have a query that takes in arguments, you may want to look at http://www.oracle.com/technology/products/jdev/tips/shmeltzer/setwhereclause/index.html
    Basically it boils down to passing text etc. to the arguments of your query.

Maybe you are looking for

  • "F4" search-help for custom field in PCUI

    Hello all, Does anyone know how I can create my own simple F4-help for a custom field I have added to a custom Tab Page in the PCUI? It should show a selection from a custom table. I couldn't find an useable example in the PCUI-cookbook. Any ideas an

  • Folder Creation in Answers

    I created a folder within an existing folder using the Manage Catelog Option >> Create New Folder in OBIEE Answers. Although I can see the folder created in the "manage catelog" window, I cannot see the folder in the left most pane as part of the tre

  • Initialization parameters not getting populated correctly during DBCA

    This problem is observed on Oracle 10.2.0.1 Linux x86 and RedHat Enterprise Linux 4 ES Update 5. I tried to use DBCA template file to create an Oracle database (see below for the template file content). The DB creation was successful, but the initial

  • SAP master data analysis

    Hi Experts, I have given activity to analyze, validate and test bulk master datas in SAP system. How can I test data integrity and ensure all appropriate master datas are in place like customer, vendor, material in SAP are accurately maintained. Its

  • Cannot find request in Catalog manager:OBIEE 10.1.3.3.2

    hi friends, Im not able to find an request in catalog manager. An report exists in Shared folders->Lh-> Content report but when i open catalog manager and browse in same folder, im not able to view. Could anyone help me on this issue. Currently the f