Toplink named query and firstrow

In one of our projects we have a need to chunk records returned by a Toplink query.
For example if a query retrieves 1000 rows we need to chunk records in batches of a variable number.
Lets assume for this one request we need to chunk these 1000 rows in batches of 50 records. Is there a way to do this with Toplink?
I tried to create a named query and then am setting the first row to 0 and max rows to 20
And in a loop I am adding 20 to the value of the first row.
This does not work. The first time the query runs the first row = 0 and the max rows = 20 and I get 20 records back as I expected, but the next time the query runs after I change the value of firstrows to 21 and I do not get any records back even though the DB has a 1000 records.
Is it possible to do this sort of batching of the result set? I appreciate any pointers on how to solve this
Thanks a lot for the help

Hello,
MaxRows is independent of firstResult in TopLink; unless using a database that supports pagination, MaxRows is applied to the statement, and then firstresults used on the returned resultset to skip to the desired first row. So, the driver would return 20 rows, and then firstResult skips to row 20 - so nothing gets returned.
MaxRows and FirstResult are used in TopLink as the range you want to be returned. So both need to be incremented so that the difference between them is the max number of rows you want returned - MaxRows could be better described as a LastResult instead.
Best Regards,
Chris

Similar Messages

  • TopLink named query issue

    We are using Jdeveloper 10.1.3.3, TopLink, ADF JSF Faces. I have an issue with TopLink named query. I am passing a value to parameter defined in the TopLink named query. The problem is that the parameter value is not being set when JSP page is loading for the first time and TopLink named query is not returning any results. When I click a button or refresh the page or some user action, then only the parameter value is set in the TopLink named query and returning the query results.Is this TopLink issue or is there any way to invoke action to fire the TopLink named query with the parameter value being passed at the time of loading JSP page ?
    Our project is held up due to this issue and I will highly appreciate if someone can help on this?
    Thanks in Advance.

    Go to your toplink map in the application navigator, select the descriptor in the structure pane and then click on the "Queries" tab in the editor pane. You should be able to configure your named query there.
    Hope this helps.
    Anuj

  • Toplink Named Query - Creating the Expression

    In JDeveloper, I have this scenario.
    I’ve created a:
    Name.java – private String name;
    Managed Bean – Name - id, Class - paperless.Name, Scope - session
    Toplink Named Query --> findUserProfile
    Type --> ReadObjectQuery
    In the format tab, I’m using “Expression” and it is “1. pp_Username EQUAL “#{id.name}”
    I’m trying to do a query on pp_Username where pp_Username equals the login name that I have stored in the session (id.name). I can only assume that I have my express written incorrectly. When I run it, I just get nothing. Any ideas?

    Go to your toplink map in the application navigator, select the descriptor in the structure pane and then click on the "Queries" tab in the editor pane. You should be able to configure your named query there.
    Hope this helps.
    Anuj

  • Toplink named query returns maximum 1413 results

    Hi all.
    As the heading states, I have a Toplink named query that returns 1413 results when it should return 3030. Is this configured somewhere? thanks in advance.

    Go to your toplink map in the application navigator, select the descriptor in the structure pane and then click on the "Queries" tab in the editor pane. You should be able to configure your named query there.
    Hope this helps.
    Anuj

  • Adding "order by" functionality to the expression of a toplink named query

    hello,
    using JDev 10.1.3, I have made a Toplink named query findCustomersByCompany with a parameter company (String) to pass the name of the company of interest. I used the expression option from the format tab with"1.companyId LIKE IGNORE CASE company".
    The selection works fine but now I want the results to be ordered by customer name, the native order in the database is based on creation date.
    How can I add the order by clause to my named query using the expression format?
    kind regards,
    Nemata

    Look at http://www.thespot4oracle.com/SQL/re-6593_Adding-an-ordering-clause-using-a-TopLink-amendment-method.aspx
    Hope this helps.

  • Error when use stored procedure in Named Query and Custom SQL

    This is a toplink development on Jdev 1013. A package with a function is created which returns a "ref cursor" in a oracle 9i database. I tried to access the function in jdev toplink descriptor editor either through custom sql (Readall) or a named query (procedureTest) and I got java.sql.SQLException: SQL string is not Query. Note: I am NOT talking about programatic storedprocedurecall object.
    The client access code is following (where error was thrown):
    results = (Collection) session.executeQuery("procedureTest", WuTest.class);

    Any responses? Thanks.

  • 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

  • Clone of TopLink named query

    One of our projects here has a requirement where they'd like to modify, at runtime, the named query defined in the Mapping Workbench.
    One example is to set the refresh depth level (cascadePrivateParts, cascadeAll, for example) for the named query so that the defined query could be used in different scenarios with slightly different query options to get different query results.
    To support this, we will need to clone the query. See the sample code below:
    ObjectLevelReadQuery toplinkQuery = null;
    ObjectLevelReadQuery queryClone = null;
    Descriptor descriptor = session.getDescriptor(targetClass);
    DescriptorQueryManager queryManager = descriptor.getQueryManager();
    toplinkQuery = (ObjectLevelReadQuery)queryManager.getQuery(queryName);
    queryClone = (ObjectLevelReadQuery)toplinkQuery.clone();
    We try to use the clone method in DatabaseQuery. It seems to be working fine from the unit testing.
    Could someone provide me some information regarding the overhead (performance penalty) the clone method introduces?
    Thanks.
    Haiwei

    James,
    Thanks very much for your quick response.
    "The difference between using the clone vs not using the clone, is that clone (and changing the query) will trigger the query to no longer be prepared. This means that the query will need to re-generate the SQL for every execution."
    Is this always true or it depends on what query options got changed?
    I tried the cloneQuery with cloneQuery.cascadePrivateParts(). It seems that (from the trace) it still uses the prepared SQL. Here is the trace:
    in testQuery .....
    [3/8/05 15:27:47:027 EST] d510d51 SystemOut O 2005.03.08 03:27:47.027--ServerSession(1090797828)--Thread[Servlet.Engine.Transports : 1,5,main]--Connection(290525521)--SELECT * FROM QUOTE WHERE ID IN (?,?)
         bind =&gt; [1, 2]
    [3/8/05 15:27:47:037 EST] d510d51 SystemOut O 2005.03.08 03:27:47.037--ServerSession(1090797828)--Thread[Servlet.Engine.Transports : 1,5,main]--Connection(759639367)--SELECT NAME, ID, VERSION FROM USER04.SUBQUOTE WHERE (QUOTE_ID = ?)
         bind =&gt; [1]
    [3/8/05 15:27:47:037 EST] d510d51 SystemOut O 2005.03.08 03:27:47.037--ClientSession(219090191)--Thread[Servlet.Engine.Transports : 1,5,main]--client released
    A separate question, the cascade option is not configurable in the Mapping Workbench, is this something that TopLink deliberately does not provide?
    Thanks again for your assistance.

  • "where contains" in Toplink named query

    I´m using Toplink named queries to find documents in database. How can i use a parameter "keyword" inside an sql-statement? The statement looks like:
    select score(1), ID_DOCUMENTS_INDICATED, nvl(NAME,'--'), CREATE_DATE, LAST_UPDATE, USER_ID from IFCOB_DOCUMENTS_INDICATED where contains(BLOB_CONTENT, #keyword , 1) > 0;
    "keyword" is a String from an users input. I´m using JDeveloper 10.1.3 so there isn´t any TextWizzard for my jspx-application. Any solutions?
    Thx, Don

    Go to your toplink map in the application navigator, select the descriptor in the structure pane and then click on the "Queries" tab in the editor pane. You should be able to configure your named query there.
    Hope this helps.
    Anuj

  • TopLink doesn't sort data received using Named query

    Hello!
    I'm trying to build a Tree table using a TopLink Named query in my application.
    There are Id, Parent|_Id, Code and Name columns in the corresponding database table, where Id and Parent|_Id are linked together by Foreign key (typical tree). I used TopLink to describe this table in the Model part of my application. There I wrote a Named query, without using a query constructor (not Expression radio button, but SQL radio button). Here the text of query:
    select * from regions a connect by prior a.Id = a.Parent_Id start
    with a.Id is null order by a.Code
    Then I created a Data control and tried to build a JSF page with data based on this query, as tree-table.
    But I discovered the fact, that data under the same node on the same leaf level of the Tree are not sorted by code on the JSF page. For example, data may be situated as follows (Code - Name):
    2. wwwwwwwwwwww
    2.3.kkkkkkkkkkkk
    2.1.fffffffffffffffffffff
    2.2.oooooooooo
    1. qqqqqqqqqqqqqqqq
    1. 2. lllllllllllllllllllllllllllll
    1. 1. hhhhhhhhhhhhhh
    etc.
    I verified this query on other environment (PL/SQL Developer, SQL+), but didn't found such unsorted results anywhere.
    Please, give me an advice to avoid this problem.
    Thanks.

    Hi
    Something to do with TreeMap(TreeSet). I tried with TreeSet but it didn't work. Here is the code :
    In servlet :
    Connection lConnection = getConnection(pRequest);
    String lSQL = "";
    Statement lStatement;
    ResultSet lResultSet;
    Hashtable lLtypeHashtable = new Hashtable();
    lStatement = lConnection.createStatement();
    lSQL = "SELECT RCID,RCMEANING FROM REFERENCECODES WHERE RCDOMAIN = 'LOCATIONTYPE' AND RCROWSTATE > 0 order by RCMEANING";
    lResultSet = lStatement.executeQuery(lSQL);
    while(lResultSet.next())
    String lRcid = lResultSet.getString(1);
    String lRcmeaning = lResultSet.getString(2);
    lLtypeHashtable.put(lRcid.trim(),lRcmeaning.trim());
    if(lResultSet != null) lResultSet.close();
    if(lStatement != null) lStatement.close();
    pRequest.setAttribute("LtypeHashtable",lLtypeHashtable);
    //Below Query is executed when one data from select element is selected
    String lLType = DisplayUtilities.getString(pRequest.getParameter("LType"),true);
    //LType is name of select element in JSP.
    if (lLType != null)
    lSQL = lSQL + " AND " + lUpperCaseFunction + "(LOCATIONTYPE)" +
    " = " + DBUtilities.formatString(lLType.toUpperCase());
    pRequest.setAttribute("rLType",lLType+"");
    In JSp :
    <%
    Hashtable lLtypeHashtable = (Hashtable)request.getAttribute("LtypeHashtable");
    %>
    <TR>
    <TD width="15%"> <div align="left">
    <select name="LType" size="1" >
    <option Value="">< Select ></option>
    <%
    if(lLtypeHashtable != null)
    Enumeration enum = lLtypeHashtable.keys();
    while(enum.hasMoreElements())
    String key = (String)enum.nextElement();
    String value = (String)lLtypeHashtable.get(key);
    String flagBack = "";
    if(key.equals((String)request.getAttribute("rLType")))
    flagBack = "selected";
    %>
    <option Value="<%=key%>" <%=flagBack%>><%=value%></option>
    <%
    %>
    </select></div>
    </TD>
    </TR>
    How should I implement TreeSet?
    Looking forward for an early reply.
    Thanks.

  • AVG calculation and syntax error while parsing a named query

    Hi all,
    I've to calcolate the average of polling results for each value column (5 value column in total). I want to use this single row result line for a bar graph.
    I created a new named query in the EJB:
    @NamedQueries({
      @NamedQuery(name = "Polls.findAll", query = "select o from Polls o"),
      @NamedQuery(name = "Polls.findAVG", query = "select o AVG(Value1) as Value1, AVG(Value2)  as Value2, AVG(Value3)  as Value3, AVG(Value4)  as Value4, AVG(Value5)  as Value5 o from Polls o")   // <-- my named query
    ...I tried it in the sql query tool of Oracle 10g XE and sql syntax is ok, but when I run my javaServiceFacade on JDev I receive this message:
    Exception in thread "main" Local Exception Stack:
    Exception [EclipseLink-8023] (Eclipse Persistence Services - 1.0.1 (Build 20080905)): org.eclipse.persistence.exceptions.JPQLException
    Exception Description: Syntax error parsing the query [Polls.findAVG: select AVG(Value1) as Value1, AVG(Value2)  as Value2, AVG(Value3) as Value3, AVG(Value4) as Value4, AVG(Value5) as Value5 o from Polls o].
    Internal Exception: org.eclipse.persistence.internal.libraries.antlr.runtime.EarlyExitException
    ...Where is the syntax error in my named query?
    Edited by: Silicio on 22-nov-2008 1.05

    Thanks Shay, now I think syntax is correct for gain an average for each column:
    @NamedQuery(name = "Polls.findAVG", query = "select AVG(o.value1), AVG(o.value2), AVG(o.value3), AVG(o.value4), AVG(o.value5) from Polls o")But still got some trouble to get a bar graph...
    If I drag&drop that query from data control, I get an empty graph with 5 values ,look http://img153.imageshack.us/img153/8710/emptygraphag7.png .
    In the log there is some errors (due that named query and its methods in EJB):
    AVVERTENZA: Transient state added to StateManager.  State may not be serialized.  State id:  data.oracle_view_risultatiPageDef.Polls1__cubicDefinition
    23-nov-2008 11.08.28 oracle.adf.share.http.HttpSessionStateManagerImpl putState
    AVVERTENZA: Transient state added to StateManager.  State may not be serialized.  State id:  data.oracle_view_risultatiPageDef.Polls1__dataModel
    [EL Info]: 2008.11.23 11:08:29.546--ServerSession(20936795)--EclipseLink, version: Eclipse Persistence Services - 1.0.1 (Build 20080905)
    [EL Info]: 2008.11.23 11:08:29.562--ServerSession(20936795)--Server: WebLogic Server Temporary Patch for CR380042 Thu Sep 11 13:33:40 PDT 2008
    [EL Info]: 2008.11.23 11:08:29.562--ServerSession(20936795)--file:/C:/Oracle/Middleware/jdeveloper/system/system11.1.1.0.31.51.56/o.j2ee/drs/Application13/Application13-Model-ejb/-Model login successful
    23-nov-2008 11.08.37 oracle.adfinternal.view.faces.config.rich.RegistrationConfigurator handleError
    GRAVE: Server Exception during PPR, #1
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: groovy.lang.MissingPropertyException, msg=Exception evaluating property 'id' for java.util.Arrays$ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: id for class: java.lang.Double
         at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:753)
         at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:779)
         at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:690)
         at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:1816)
         at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1554)
         at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1634)
         at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:746)
         at oracle.adf.model.bean.DCDataRow.getAttributeInternal(DCDataRow.java:352)
         at oracle.jbo.server.ViewRowImpl.getKey(ViewRowImpl.java:598)
         at oracle.adf.model.bean.DCDataRow.getKey(DCDataRow.java:149)
         at oracle.adf.model.binding.DCIteratorBinding.buildFormToken(DCIteratorBinding.java:3836)
         at oracle.adf.model.binding.DCBindingContainerState.buildStringBuffer(DCBindingContainerState.java:71)
         at oracle.adf.model.binding.DCBindingContainerState.toString(DCBindingContainerState.java:590)
         at oracle.adf.model.binding.DCBindingContainer.getStateToken(DCBindingContainer.java:4293)
         at oracle.adfinternal.controller.application.model.SaveStateTokenListener.afterPhase(SaveStateTokenListener.java:54)
         at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.afterPhase(ADFLifecycleImpl.java:529)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchAfterEvent(LifecycleImpl.java:118)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.dispatchAfterPagePhaseEvent(LifecycleImpl.java:166)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.dispatchAfterPagePhaseEvent(ADFPhaseListener.java:122)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:68)
         at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:51)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:354)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:203)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:278)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:238)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:195)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:138)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:102)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: groovy.lang.MissingPropertyException: Exception evaluating property 'id' for java.util.Arrays$ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: id for class: java.lang.Double
         at org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(DefaultGroovyMethods.java:2978)
         at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1368)
         at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:2578)
         at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:178)
         at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:474)
         at Script1.run(Script1.groovy)
         at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:741)
         ... 50 more
    ## Detail 0 ##
    groovy.lang.MissingPropertyException: Exception evaluating property 'id' for java.util.Arrays$ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: id for class: java.lang.Double
         at org.codehaus.groovy.runtime.DefaultGroovyMethods.getAt(DefaultGroovyMethods.java:2978)
         at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1368)
         at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:2578)
         at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:178)
         at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:474)
         at Script1.run(Script1.groovy)
         at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:741)
         at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:779)
         at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:690)
         at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:1816)
         at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1554)
         at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1634)
         at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:746)
         at oracle.adf.model.bean.DCDataRow.getAttributeInternal(DCDataRow.java:352)
         at oracle.jbo.server.ViewRowImpl.getKey(ViewRowImpl.java:598)
         at oracle.adf.model.bean.DCDataRow.getKey(DCDataRow.java:149)
         at oracle.adf.model.binding.DCIteratorBinding.buildFormToken(DCIteratorBinding.java:3836)
         at oracle.adf.model.binding.DCBindingContainerState.buildStringBuffer(DCBindingContainerState.java:71)
         at oracle.adf.model.binding.DCBindingContainerState.toString(DCBindingContainerState.java:590)
         at oracle.adf.model.binding.DCBindingContainer.getStateToken(DCBindingContainer.java:4293)
         at oracle.adfinternal.controller.application.model.SaveStateTokenListener.afterPhase(SaveStateTokenListener.java:54)
         at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.afterPhase(ADFLifecycleImpl.java:529)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchAfterEvent(LifecycleImpl.java:118)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.dispatchAfterPagePhaseEvent(LifecycleImpl.java:166)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.dispatchAfterPagePhaseEvent(ADFPhaseListener.java:122)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:68)
         at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:51)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:354)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:203)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:278)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:238)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:195)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:138)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:102)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)I try to print out a singlue AVG value in this way (main method of javaServerFacade class):
        public static void main(String [] args) {
            final JavaServiceFacade javaServiceFacade = new JavaServiceFacade();
            //  TODO:  Call methods on javaServiceFacade here...
            List<Polls> pollsAVG = javaServiceFacade.queryPollsFindAVG();
            for (Polls a: pollsAVG){
                System.out.println(a.getValue1());
    ...I get this error:
    Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to oracle.model.Polls
         at oracle.model.JavaServiceFacade.main(JavaServiceFacade.java:25)
    Process exited with exit code 1.
    ...I've searched for Ljava in the documantation finding nothing interesting.

  • Creating Named Query: from OracleCallableStatement

    We have a great many PL/SQL Procs in an existing legacy system that return PL/SQL Boolean, that we wish to call from toplink.
    Ideally we would like to create Toplink Nameded queries that wrap the SQL call statements.
    Does anyone know if its possible to convert a call like the following into a Toplink named query?
    String domain = "COST CENTRE";
    String value = "OP";
    OracleCallableStatement xcall = (OracleCallableStatement) con.prepareCall(
    "BEGIN ? := SYS.SQLJUTL.bool2int(is_valid_value(?, ?)); END;");
    xcall.registerOutParameter( 1, OracleTypes.INTEGER);
    xcall.setString(2,domain);
    xcall.setString(3,value);
    xcall.execute();
    System.out.println ("Status = " + xcall.getInt(1));
    FUNCTION is_valid_value(
    p_rv_domain IN CG_REF_CODES.RV_DOMAIN%TYPE,
    p_rv_low_value IN CG_REF_CODES.RV_LOW_VALUE%TYPE
    RETURN BOOLEAN
    IS
    Many thanks,
    Lee.

    You can define Stored Procedure calls in TopLink through the StoredProcedureCall class. StoredProcedureCall allows you to define output parameters to access return values.
    Example:
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("is_valid_value");
    call.addNamedArgumentValue("DOMAIN", domain);
    call.addNamedArgumentValue("VALUE", value);
    call.addNamedOutputArgument("RESULT", "RESULT", Integer.class);
    List results = session.executeSelectingCall(call);
    boolean value = ((Integer) ((Map) results.get(0)).get("RESULT")).intValue() == 0;
    However what you seem to be accessing is a stored function, not a procedure. To access a stored function from TopLink you must use an SQLCall and select the return value through the DUAL table.
    Example:
    SQLCall call = new SQLCall("Select SYS.SQLJUTL.bool2int(is_valid_value(" + domain + ", " + value + ")) from dual");
    List results = session.executeSelectingCall(call);

  • Named query question

    Hi Guys,
    I have the following problem - I know I did something wrong, but I cannot figure out how to correct it. Here is my question:
    I have a table tableA, with composite key (col1, col2, col3, col4). I mapped the table, and create a Toplink named query (findCol3List)as such:
    select distinct col3
    from tableA
    where col1=#col1 and col2=#col2
    I created an EJB session method getCol3List(col1, col2) -
    now when I run the application to call this EJB method, I got the following error at line:
    List results = (List)session.executeQuery("findCol3List", String.class, params);
    Exception Description: Missing descriptor for [java.lang.String] for query named [findCol3List].
    I know there are multiple mistakes in my approach, but with my limited Toklink knowledge, I could not figure out.
    Any help with be appreciated!

    hello,
    The executeQuery method is trying to look up the "findCol3List" in the descriptor for the class passed in. It is complaining because you passed in String.class which does not have a valid descriptor.
    How/where did you define the named query? Chances are you defined it in the class used for TableA, and so should specify it in the executeQuery method:
    session.executeQuery("findCol3List", tableA.class, params);
    Best Regards,
    Chris

  • Named query

    hi all,
    i am newbie in toplink.
    i want to define a named query in toplink mapping workbench (for example test).
    how can i call this named query and execute it.
    need help

    The query would depend on what your object model is, and what you are querying for. To use arguments with named-queries use the expressionBuilder.getParameter(/) method.
    Example:
    ReadAllQuery query = new ReadAllQuery();
    ExpressionBuilder niveau = new ExpressionBuilder();
    query.setSelectionCriteria(
    niveau.get("rubrique").get("morasse").get("entite").
    equal(niveau.getParameter("entite"));
    query.addArgument("entite");
    descriptor.getQueryManager().addQuery("findByEntite", query);
    List result = (List) session.executeQuery(Niveau.class, "entite-value");

  • Treat objects from named query as new ones

    Hello,
    I use TopLink 11.1.1.1.0 and I need to do following. I want to read object from database with named query and let TopLink treat them like new object created in java. Is it possible? Obejcts are in one table but the named query computes them with select from several different tables, so this obejcts are not present in the table.
    Why I need it? It is import of data from one module of our application to another. Previously it was done in java. About 500 000 objects were read in one module just to convert into 20 000 objects in another module. If database does this conversion (named query with grouping which reads the 20 000 objects) it is much faster and take much less memory.
    What I can do is to create new class with the same fields query this objects and then copy them to object I need. But I don't like creating new class just for this.
    Thank for any help
    Frank

    Thanks for help I solved it different way eventually. I made a stored procedure which inserts data to the table of SOURCE_ITEMS. First I call stored procedure, then I load all new created SOURCE_ITEMS with ReadAllQuery (I have business parameters by which to select them) and make post processing in java with them. I used StoredProcedureCall in TopLink so if exception occurs and transaction rollbacks, stored procedure will rollback as well (I tried it, works for sure:).
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName(SQL_IMPORT_CALL);
    call.addNamedArgumentValue(SQL_IMPORT_PARAM_1, getId());
    call.addNamedArgumentValue(SQL_IMPORT_PARAM_2, getXXX().getId());
    call.addNamedArgumentValue(SQL_IMPORT_PARAM_3, getYYY.getId());
    call.addNamedArgumentValue(SQL_IMPORT_PARAM_4, getZZZ());
    DataModifyQuery query = new DataModifyQuery();
    query.setCall(call);
    query.setShouldBindAllParameters(true);
    // insert of imported SOURCE_ITEMS
    ctx.executeQuery(query);
    Thanks Chris and hope this will help to somebody else as well..
    Frank
    Edited by: user604333 on Nov 17, 2010 12:20 PM
    Edited by: user604333 on Nov 17, 2010 12:20 PM
    Edited by: user604333 on Nov 17, 2010 12:20 PM

Maybe you are looking for

  • How to use p_mainsearch parameter in basic search for a report with bind variable?

    Hello, I'd like to extend the basic-search in content-area elements to extra records in my own tables. So I'd like to use the p_mainsearch-urlparameter (which holds the searchtext of a basic search) into a bind variable of my own report. My report wi

  • Bug: NULL bytes being written to file on SMB volumes

    This is a 100% reproducable bug. When writing to files that are on a Samba (SMB) volume, if you are overwriting a file and making it smaller than it previously was, then OSX is writing NULL bytes to the end fo the file, which produce all sorts of pro

  • How to hide password while entering into second page

    I have following script but while going into 2nd page from 1st page, ID and password are visible in adress bar.... <HEAD> <TITLE>T&E Profiling</TITLE> <STYLE> .headertxt { font-family : Arial; color : #FFFFFF; font-size : 14pt; font-weight : bold; fo

  • Disk Images Won't Mount: Broken Pipe

    iBook G4 933 MHz, 640 MB RAM, OS X 10.4.8. I have two Macs: the offender above, and an eMac G4 800 MHz, both running OS X 10.4.8. Lately, my iBook has refused to mount Disk Images (.dmg format), instead giving a "broken pipe" error. Below is the syst

  • UI design for a app with around 10 UI screens

    Hi, I'm going to develop my first iPad/iPhone app. It'll have around 10 UI screens. The inital UI will have 4 buttons. When click on each button they'll move to other screens. This is how I'm planning to develop it. Create a Xcode project as a Single