JPA Named Parameters, with collections

Hi
Is it possible with JPA to pass in a collection as named parameter into a query.
ArrayList() list = new ArrayList();
list.add("1");
lsit.add("2");
i.e. em.createNamedQuery("named").setParameter("collection",list).getResultList();
where the named query is something like
SELECT i FROM Person i WHERE i.address IN (:collection)
This throws an error: IllegalArgumentException: You have attempted to set a value of type class java.util.ArrayList for parameter collection with expected type of class java.lang.String from query
If it is possible what am i doing wrong??
Thanks
Message was edited by:
glen_

Though this is possible in TopLink's expression framework, it is against the JPA spec. Section 4.6.8 states: "The literal and/or input_parameter values must be like the same abstract schema type of the state_field_path_expression in type", hence the exception in TopLink Essentials.
I've added feature request https://glassfish.dev.java.net/issues/show_bug.cgi?id=2484 for this functionality.
Best regards,
Chris

Similar Messages

  • Using named parameters with an sql UPDATE statement

    I am trying to write a simple? application on my Windows 7 PC using HTML, Javascript and Sqlite.  I have created a database with a 3 row table and pre-populated it with data.  I have written an HTML data entry form for modifying the data and am able to open the database and populate the form.  I am having trouble with my UPDATE function.  The current version of the function will saves the entry in the last row of the HTML table into the first two rows of the Sqlite data table -- but I'm so worn out on this that I can't tell if it is accidental or the clue I need to fix it.
    This is the full contents of the function . . .
         updateData = new air.SQLStatement();
         updateData.sqlConnection = conn;
         updateData.text = "UPDATE tablename SET Gsts = "Gsts, Gwid = :Gwid, GTitle = :GTitle WHERE GId = ":GId;
              var x = document.getElementsById("formname");
              for (var i = 1, row, row = x.rows[i]; i++) {
                   updateData.parameters[":GId"] = 1;
                   for (var j = 0, col; col=row.cells[j]; j++) {
                        switch(j) {
                             case 0: updateData.parameters[":GTitle"] = col.firstChild.value; break;
                             case 1: updateData.parameters[":Gsts"] = col.firstChild.value; break;
                             case 2: updateData.parameters[":Gwid"] = col.firstChild.value; break;
    Note: When I inspect the contents of the col.firstChild.value cases, they show the proper data as entered in the form -- it just isn't being updated into the proper rows of the Sqlite table.
    Am I using the named parameters correctly? I couldn't find much information on the proper use of parameters in an UPDATE statement.

    Thank you for the notes.  Yes, the misplaced quotes were typos.  I'm handtyping a truncated version of the function so I don't put too much info in the post. And yes, i = 1 'cuz the first rows of the table are titles.  So the current frustration is that I seem to be assigning all the right data to the right parameters but nothing is saving to the database.
    I declare updateData as a variable at the top of the script file
    Then I start a function for updating the data which establishes the sql connection as shown above.
    The correctly typed.text statement is:
            updateData.text = "UPDATE tablename SET Gsts=:Gsts, Gwid=:Gwid, GTitle=:GTitle WHERE GId=:GId";
    (The data I'm saving is entered in text boxes inside table cells.) And the current version of the loop is:
            myTable = document.getElementById("GaugeSts");
            myRows= myTable.rows;
              for(i=1, i<myRows.length, i++) {
                   updateData.parameters[":GId"]=i;
                   for(j=0; j<myRows(i).cells.length, j++) {
                        switch(y) {
                             case 0: updateData.parameters[":GTitle"]=myrows[i].cells[y].firstChild.value; break;
                             case 1: updateData.parameters[":Gsts"]=myrows[i].cells[y].firstChild.value; break;
                             case 2: updateData.parameters[":Gwid"]=myrows[i].cells[y].firstChild.value; break;
                             updateData.execute;
    The whole thing runs without error and when I include the statements to check what's in myrows[i].cells[y].firstChild.value, I'm seeing that the correct data is being picked up for assignment to the parameters and the update. I haven't been able to double check that the contents of the parameters are actually taking the data 'cuz I don't know how to extract the data from the parameters. ( The only reference  I've found so far has said that it is not possible. I'm still researching that one.) I've also tried moving the position of the updateData execution statement to several different locations in the loop andstill nothing updates. 
    I am using a combination of air.Introspector.Console.log to check the results of code and I'm using Firefox's SQlite manager to handle the database.  The database is currently sitting on the Desktop to facilitate testing and I have successfully updated/changed data in this table through the SQLite Manager so I don't think I'm having permission errors and, see below, I have another function successfully saving data to another table.
    I currently have another function that uses ? for the parametersin the .text of a INSERT/REPLACE statement and that one works fine.  But, only one line of data is being saved so there is no loop involved.  I tried changing the UPDATE statement in this function to the INSERT/REPLACE just to make something save back to the database but I can't make that one work either.I've a (And, I've tried so many things now, I don't even remember what actually saved something --albeit incorrectly --to the database in one of my previous iterations with the for loops.)
    I'm currently poring through Sqlite and Javascript tomes to see if I can find what's missing but if anything else jumps out at you with the corrected code, I'd appreciate some ideas.
    Jeane

  • Named Parameters in Functions: Possible?

    I want to use named parameters to call PL/SQL functions using JDBC, as is best practice and necessary for default values to work. Unfortunatley all the examples I found are for procedures only. Using a positional registerOutParameter with named register / get methods on the CallableStatement does not work, obiviously.
    Is there any proper way to use named parameters with functions ? Proper does not include writing wrapper procedures nor turning functions into procedures.

    Hi Avi,
    as far as I know the return value of a PL/SQL function does not have a name, as oposed to the parameters of a PL/SQL function, which must have a name. One could argue that the return value of a function is called the same as the function itself. I have tried that option but it does not work.
    Unfortunatley the method OraclePreparedStatement.registerReturnParameter refers to something else than the return value of a PL/SQL function. Is it possible that the developers of the driver have forgotten something?

  • JavaDB or Toplink not recognizing named parameters?

    Creating a query within a session bean but the named parameter is causing an exception. Using Derby with Toplink in the Sun App Server 9.0_01. Any ideas what the problem or solution is?
        public String getNumberOfInvoices(String supplierAccount) {
            String suppAcc = "";
            Query qry = em.createNativeQuery(
                    "select count(d) from App.Documents as d " +
                    "where d.PERSONALACCOUNT = :suppAcc;");
            qry.setParameter("suppAcc", supplierAccount);
            Long count = (Long) qry.getSingleResult();
            return Long.toString(count);
    [#|2007-09-22T23:41:09.271+0100|WARNING|sun-appserver-pe9.0|oracle.toplink.essentials.file:/C:/Sun/SDK/domains/domain1/applications/j2ee-apps/Accounting/Accounting-ejb_jar/-Accounting-ejbPU|_ThreadID=16;_ThreadName=httpWorkerThread-8080-1;_RequestID=4ffb3c50-34f3-42cf-a00b-26e93a0f8ed6;|
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: org.apache.derby.client.am.SqlException: Syntax error: Encountered ":" at line 1, column 67.Error Code: -1
    Call:select count(d) from App.Documents as d where d.PERSONALACCOUNT = :suppAcc;
    Query:DataReadQuery()
         at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:303)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:551)
         at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:437)
         at oracle.toplink.essentials.threetier.ServerSession.executeCall(ServerSession.java:465)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:213)
         at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:199)

    This seems to have resolved the problem to a degree. I am not sure why
    numeric parameters are accepted but named one are not. I don't know. I can do named parameters with Hibernate. I don't know TopLink.
    You understand that "named query" is different from "query with named parameters", right? You seem to want the latter, not the former. Maybe you're reading the wrong docs.
    I have also
    changed from count(d) to count(*). Is this because I am using EJB Query
    Language but createNativeQuery is plain JDBC?
    If you're counting all the rows in a table, it would be count(*). If you want to only count certain rows, it'd be a GROUP BY and HAVING.
    Any way the error is now saying:-
    Caused by: java.lang.ClassCastException: java.util.Vector cannot be cast
    to java.lang.Long
    This is pretty clear. You're assuming that the method returns a Long and it's telling you that it returns a Vector. It should only have size 1, and you should get the zeroth index value out of it.
    %

  • 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

  • Call procedure with named parameters

    Call procedure with positional parameters works, but with named parameters gives an ORA-907.
    This post seems similar: Re: Error with report - pkg and bind var
    Run as a script:
    set echo on
    call dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS', cascade_columns=>true, no_invalidate=>false);
    call dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS');
    begin dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS', cascade_columns=>true, no_invalidate=>false); end;
    gives:
    set echo on
    call dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS', cascade_columns=>true, no_invalidate=>false)
    Error starting at line 2 in command:
    call dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS', cascade_columns=>true, no_invalidate=>false)
    Error report:
    SQL Error: ORA-00907: missing right parenthesis
    00907. 00000 - "missing right parenthesis"
    *Cause:
    *Action:
    call dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS')
    call dbms_stats.delete_table_stats succeeded.
    begin dbms_stats.delete_table_stats ('ZZZMIG', 'CHAINED_ROWS', cascade_columns=>true, no_invalidate=>false); end;
    anonymous block completed
    I like the idea of using call, because the procedure name appears in the feedback - useful in longer scripts.
    I'm using SQL Developer Version 1.5.1 Build MAIN-5440
    on Windows XP SP3
    with database EE 10.2.0.3

    CALL is a SQL command which executes a routine
    (procedure/function)
    http://download-uk.oracle.com/docs/cd/B19306_01/server
    .102/b14200/statements_4008.htm
    whereas EXECUTE is a SQL*Plus command which executes
    a single PL/SQL statement
    http://download-uk.oracle.com/docs/cd/B19306_01/server
    .102/b14357/ch12022.htm#i2697931
    Message was edited by:
    Jens PetersenThank you very much, esp. for the links!

  • NOT Using Named Parameters in a Native Query

    Hi!
    like it is written in the Toplink JPA Extensions reference Toplink supports using named parameters in native queries.
    See example from http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-extensions.html:
    Example 1-11 Specifying a Named Parameter With #
    Query queryEmployees = entityManager.createNativeQuery(
    "SELECT OBJECT(emp) FROM Employee emp WHERE emp.firstName = #firstname"
    queryEmployeeByFirstName.setParameter("firstName", "Joan");
    Collection employees = queryEmployees.getResultList();
    But I want to use "#" in the SQL statement so I want to disable this parameter binding somehow and let the query just execute the SELECT statement I deliver.
    I have tried to add the property
    <property name="toplink.jdbc.bind-parameters" value="false"/>
    into the persistence.xml and I have also tried to add the query hint
    query.setHint(TopLinkQueryHints.BIND_PARAMETERS, HintValues.FALSE);
    but none of them prevents the # to be uses as a paramter. this causes the exception:
    Exception [TOPLINK-6132] (Oracle TopLink Essentials - 9.1 (Build b22)): oracle.toplink.essentials.exceptions.QueryException
    Exception Description: Query argument ######' not found in list of parameters provided during query execution.
    Query: ReadAllQuery(de.merck.compas.material.SimilarLocalMaterialListItemBV)
    The SQL Statement is
    SELECT * FROM TABLE (
    CAST ( RCGC.PHA_P_COMPASMDM.LookupSimilarMats
    ( 'COC003','10021500150000000997','30','30','040','standard','','001001','001001','123456','##########','X','X','X','X','U' )
    AS RCGC.PHA_COMPAS_SIMILAR_MATS ) )
    I am using the latest Toplink essentials build together with an Oracle 9.2i DB in a Java SE web application.
    Can anyone give me a little hint what to do?
    Thanks and best regards,
    Alex

    I hope this is what you need:
    [TopLink Fine]: 2007.01.19 02:56:48.278--ServerSession(17712783)--Connection(723185)--Thread(Thread[http-8080-Processor2
    3,5,main])--SELECT APPL_CGP_MATLOC, CHANGE_REQ_MATLOC, CD_PHA_MAT_LOC, LCOMP, LOC_MAT_NAME, APPL_GDM_MATLOC, LOC_MAT_NAM
    E_SHORT, APPL_PDW_MATLOC, PHA_MAT_LOC_LCOMMENT, APPL_TP_MATLOC, DIVISION, APPL_WRS_MATLOC, ARTICLE_ID_MDA, LU_PHA_MAT_LO
    C, LOC_MAT_NAME_OLD, LDT_PHA_MAT_LOC, PHA_MAT_LOC_STATUS, CU_PHA_MAT_LOC, MAT_LOC_ID, RCOMP, MAT_ID FROM RCGC.PHA_V_COMP
    AS_MAT_MATLOC WHERE ((MAT_LOC_ID = '123456') AND (RCOMP = '001001'))
    [TopLink Fine]: 2007.01.19 02:56:48.398--ServerSession(17712783)--Connection(32404901)--Thread(Thread[http-8080-Processo
    r23,5,main])--SELECT MAT_ID, DESCRIPTION, PHA_MATERIAL_LCOMMENT, PACKSIZE, LU_PHA_MATERIAL, PACKSIZE_UNIT, LDT_PHA_MATER
    IAL, CONTAINER_NAME, CU_PHA_MATERIAL, PURPOSE, CD_PHA_MATERIAL, CONTENT, CONTAINER_ID, AI_FACTOR, PHA_MATERIAL_STATUS, C
    MG_SPEC_APP, PROD_LEVEL, PACKAGE_SIZE, PRODUCT_ID FROM RCGC.PHA_V_COMPAS_MATERIAL WHERE (MAT_ID = '10021500150000000997'
    [TopLink Fine]: 2007.01.19 02:56:48.468--ServerSession(17712783)--Connection(723185)--Thread(Thread[http-8080-Processor2
    3,5,main])--SELECT PRODUCT_ID, PROD_GRP_ID, APPL_FORM_NAME, PRODUCT_NAME, GALENIC_FORM_NAME, APPL_FORM_ID, PHA_PRODUCT_S
    TATUS, PHA_PRODUCT_LCOMMENT, GALENIC_FORM_ID, LU_PHA_PRODUCT, INN, LDT_PHA_PRODUCT FROM RCGC.PHA_V_COMPAS_PRODUCT WHERE
    (PRODUCT_ID = 'COC003')
    [TopLink Fine]: 2007.01.19 02:56:48.568--ServerSession(17712783)--Connection(32404901)--Thread(Thread[http-8080-Processo
    r23,5,main])--SELECT APPL_CGP_MATLOC, CHANGE_REQ_MATLOC, CD_PHA_MAT_LOC, LCOMP, LOC_MAT_NAME, APPL_GDM_MATLOC, LOC_MAT_N
    AME_SHORT, APPL_PDW_MATLOC, PHA_MAT_LOC_LCOMMENT, APPL_TP_MATLOC, DIVISION, APPL_WRS_MATLOC, ARTICLE_ID_MDA, LU_PHA_MAT_
    LOC, LOC_MAT_NAME_OLD, LDT_PHA_MAT_LOC, PHA_MAT_LOC_STATUS, CU_PHA_MAT_LOC, MAT_LOC_ID, RCOMP, MAT_ID FROM RCGC.PHA_V_CO
    MPAS_MAT_MATLOC WHERE (MAT_ID = '10021500150000000997')
    [TopLink Warning]: 2007.01.19 02:56:48.638--UnitOfWork(4469532)--Thread(Thread[http-8080-Processor23,5,main])--Exception
    [TOPLINK-6132] (Oracle TopLink Essentials - 9.1 (Build b22)): oracle.toplink.essentials.exceptions.QueryException
    Exception Description: Query argument ######' not found in list of parameters provided during query execution.
    Query: ReadAllQuery(de.merck.compas.material.SimilarLocalMaterialListItemBV)
    Local Exception Stack:
    Exception [TOPLINK-6132] (Oracle TopLink Essentials - 9.1 (Build b22)): oracle.toplink.essentials.exceptions.QueryExcept
    ion
    Exception Description: Query argument ######' not found in list of parameters provided during query execution.
    Query: ReadAllQuery(de.merck.compas.material.SimilarLocalMaterialListItemBV)
    at oracle.toplink.essentials.exceptions.QueryException.namedArgumentNotFoundInQueryParameters(QueryException.jav
    a:206)
    at oracle.toplink.essentials.internal.databaseaccess.DatasourceCall.getValueForInParameter(DatasourceCall.java:6
    86)
    at oracle.toplink.essentials.internal.databaseaccess.DatasourceCall.getValueForInOutParameter(DatasourceCall.jav
    a:704)
    at oracle.toplink.essentials.internal.databaseaccess.DatasourceCall.translateQueryString(DatasourceCall.java:630
    at oracle.toplink.essentials.internal.databaseaccess.DatabaseCall.translate(DatabaseCall.java:850)
    at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQuer
    yMechanism.java:212)
    at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQuer
    yMechanism.java:199)
    at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCa
    llQueryMechanism.java:270)
    at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQu
    eryMechanism.java:600)
    at oracle.toplink.essentials.queryframework.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:302)
    at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:
    709)
    at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:609)
    at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:677)
    at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:7
    31)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2218)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:346)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:447)
    at de.merck.compas.material.SimilarLocalMaterialListItemBC.selectList(SimilarLocalMaterialListItemBC.java:40)
    at de.merck.compas.material.SimilarLocalMaterialListItemBC.selectSimilar(SimilarLocalMaterialListItemBC.java:53)
    at de.merck.compas.material.MaterialMaintainFS.init(MaterialMaintainFS.java:158)
    at de.merck.compas.material.MaterialListSV.startMaterialMaintain(MaterialListSV.java:186)
    at de.merck.compas.material.MaterialListSV.processPage(MaterialListSV.java:97)
    at de.merck.jsfw.servletFramework.AbstractServlet.processPage(AbstractServlet.java:141)
    at de.merck.jsfw.servletFramework.ControllerServlet.processLastPage(ControllerServlet.java:240)
    at de.merck.jsfw.servletFramework.ControllerServlet.processRequest(ControllerServlet.java:206)
    at de.merck.jsfw.servletFramework.ControllerServlet.doGet(ControllerServlet.java:181)
    at de.merck.jsfw.servletFramework.ControllerServlet.doPost(ControllerServlet.java:191)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at de.merck.comp.ntml.NTLMFilter.negotiate(NTLMFilter.java:384)
    at de.merck.comp.ntml.NTLMFilter.doFilter(NTLMFilter.java:165)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java
    :664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
    The Toplink manifest file with version number:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.5
    Created-By: 1.5.0_09-b03 (Sun Microsystems Inc.)
    Specification-Title: Java Persistence API
    Specification-Vendor: Sun Microsystems, Inc., Oracle Corp.
    Specification-Version: 1.0
    Implementation-Title: TopLink Essentials
    Implementation-Vendor: Sun Microsystems, Inc., Oracle Corp.
    Implementation-Version: 9.1 build: b22
    Thanks again for your help!

  • Named parameters in Native SQL

    A little background first:
    Our website uses Hibernate as it's JPA provider, but we've run into several issues with it, one of which they actively refuse to fix out of pure arrogance, even when we gave them a good patch for it. The other one is a performance issue that can be greatly improved by passing arrays as parameters, which I've read rumours is supported in EclipseLink. I first tried implementing a Hibernate UserType as they've specified and it turns out they never read them into the Map that looks-up parameter types during binding, even though it's loaded from their hibernate.cfg.xml. In other words, they're only pretending to support custom user types, but unless you're writing-out the full manual loading of their configuration, there's no way to do it.
    After a day of trying to fix all the relation annotations that EclipseLink finds unacceptable in our project (which only uses native SQL and EntityManager.find for selects) I finally got it running and came to discover you don't support named parameters in native SQL. That was really disappointing, because a few months ago we migrated all our queries to named parameters, because positioning ones were too difficult to track and caused more bugs when we had to add more criterias.
    My questions are these:
    Are named parameters for native SQL not supported by JPA specifications or because they are considered low priority?
    Would you accept a patch that supports them?
    Can we really use arrays and/or lists as parameters in queries like this "SELECT * FROM some_table WHERE my_column_a IN ? AND my_column_b NOT IN ?"
    If yes to above, would it still work if the first one is an array of integers and the second is an array of strings?
    Would it work if it's in native SQL and the column types cannot be resolved due to query complexity?

    A little background first:
    Our website uses Hibernate as it's JPA provider, but we've run into several issues with it, one of which they actively refuse to fix out of pure arrogance, even when we gave them a good patch for it. The other one is a performance issue that can be greatly improved by passing arrays as parameters, which I've read rumours is supported in EclipseLink. I first tried implementing a Hibernate UserType as they've specified and it turns out they never read them into the Map that looks-up parameter types during binding, even though it's loaded from their hibernate.cfg.xml. In other words, they're only pretending to support custom user types, but unless you're writing-out the full manual loading of their configuration, there's no way to do it.
    After a day of trying to fix all the relation annotations that EclipseLink finds unacceptable in our project (which only uses native SQL and EntityManager.find for selects) I finally got it running and came to discover you don't support named parameters in native SQL. That was really disappointing, because a few months ago we migrated all our queries to named parameters, because positioning ones were too difficult to track and caused more bugs when we had to add more criterias.
    My questions are these:
    Are named parameters for native SQL not supported by JPA specifications or because they are considered low priority?
    Would you accept a patch that supports them?
    Can we really use arrays and/or lists as parameters in queries like this "SELECT * FROM some_table WHERE my_column_a IN ? AND my_column_b NOT IN ?"
    If yes to above, would it still work if the first one is an array of integers and the second is an array of strings?
    Would it work if it's in native SQL and the column types cannot be resolved due to query complexity?

  • Problem with collection names getting replaced when creating new collections in Photoshop Elements 5.0

    We have been using Photoshop Elements 5.0 a lot lately to organize many photos into collections.  A new problem just arose when creating a new collection.
    As we named the new collection and clicked on "OK" it replaced another existing collection with the new name.  The photos from the old collection were still there but now under the new collection name.  This happened at least three or four times, each time a different "old" collection was renamed.  Does anyone know why this would happen?
    This past week we have added at least 20 new collections with no problem prior to this.  Adobe actually had to shut down when this happened.  Each time we reopened Adobe it would happen again randomly renaming a different "old" collection when we tried to add the new one.  Any insights would be much appreciated.

    Thank you - that was the problem and now it is working correctly
    again!
    Tom Z.
    >>> saurabh288 <[email protected]> 05/24/09 4:23 AM >>>
    It may be that the catalog has been corupted.Try repairing the
    catalog of PSE.

  • Named Parameters in Queries - the spec vs the Java EE 5 Tutorial

    Hi,
    I've been studying the topic about the named parameters in JPA and found one inconsistency between the spec and the Java EE 5 Tutorial. Could anyone lend me a helping hand understanding it?
    The Java Persistence API spec (ejb-3_0-fr-spec-persistence.pdf) 3.6.3 "Named Parameters" at page 69 reads:
    The use of named parameters applies to the Java Persistence query language, and is not defined for native queries.
    whereas the Java EE 5 Tutorial in the section Named Parameters in Queries (http://java.sun.com/javaee/5/docs/tutorial/doc/PersistenceIntro3.html#wp81563) of The EntityManager reads:
    Named parameters are case-sensitive, and may be used by both dynamic and static queries.
    I think that the reality is that every JPA provider supports named parameters in dynamic and static queries, but it's not fully supported by the spec (yet not forbidden).
    Jacek
    Jacek Laskowski
    http://www.jaceklaskowski.pl

    Hi Jacek,
    These are not conflicting statements. Named parameters apply to the Java Persistence
    Query language only, not to native queries. There are two ways to specifiy
    Java Persistence Query Language queries : dynamically and statically. You can
    either pre-define the query string using @NamedQuery
    static :
    @NamedQuery(name="findPersonByName",
    query="SELECT OBJECT(p) FROM Person p WHERE p.name LIKE :pName")
    OR, pass the query string in at runtime using EntityManger.createQuery
    dynamic :
    em.createQuery("SELECT OBJECT(p) FROM Person p WHERE p.name LIKE :pName")
    The dynamic approach allows you to construct portions of the query string at runtime.
    My example doesn't do that but the point is that use of the createQuery()
    API is considered the dynamic approach.
    The crux of the Java EE 5 Tutorial statement you referenced is that named parameters apply to
    both the static and dynamic use of Java Persistence Query Language queries.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • The type Set is not generic; it cannot be parameterized with arguments K ?

    When I use Hashtable or HashMap to get the keySet, it shows the error of "The type Set is not generic; it cannot be parameterized with arguments <K>".
    The following is my code:
    Hashtable table = new Hashtable();
    table.put("A", new Integer(1));
    table.put("B", new Integer(2));
    Iterator its = table.keySet().iterator(); // <<<<<<<<<<<<<< this line shows the error "The type Set is not generic; it cannot be parameterized with arguments <K>"
    How can I solve it? Please help me! I have no idea on it. It works fine in 1.4.
    Best regards,
    Eric

    The original is my codes, please help!
    public static List findDlicApp(Date startDate, Date endDate, Connection con) {
              String SQL = getSQL("app.sql");
              String where = getSQL("app.sql.where");
              boolean hasWhere = false;
              if (startDate != null) {
                   SQL = SQL + " where d.create_date >= to_date('" + DMSUtil.convertDateToString(startDate) + "', 'yyyy-MM-dd')";
                   hasWhere = true;
              if (endDate != null) {
                   if (hasWhere) {
                        SQL = SQL + " and to_date(to_char(d.create_date, 'yyyy-mm-dd'), 'yyyy-mm-dd') <= to_date('" + DMSUtil.convertDateToString(endDate) + "', 'yyyy-MM-dd')";
                   } else {
                        SQL = SQL + " where to_date(to_char(d.create_date, 'yyyy-mm-dd'), 'yyyy-mm-dd') <= to_date('" + DMSUtil.convertDateToString(endDate) + "', 'yyyy-MM-dd')";
                   hasWhere = true;
              if (hasWhere) {          
                   SQL = SQL + " and " + where;
              } else {
                   SQL = SQL + " where " + where;
              SQL = SQL + " " + getSQL("app.sql.order");
              //System.out.println(SQL);
              //Connection con =  getParaDMConnection("findDlicApp");
              HashMap<String, DlicApp> dlicDocs = new HashMap<String, DlicApp>();
              List result = new ArrayList();
              try {
                   Statement stmt = con.createStatement();
                   ResultSet rs = stmt.executeQuery(SQL);
                   long lastDocID = 0;
                   boolean hasStartDate = false;
                   while(rs.next()) {
                        long docID = rs.getLong("docID");
                        String docName = rs.getString("docName");
                        String refNo = rs.getString("refNo");
                        java.util.Date createDate = rs.getDate("createDate");
                        String creator = rs.getString("creator");
                        String profileType = rs.getString("profileType");
                        String assunto = rs.getString("assunto");
                        String fromEntity = rs.getString("fromEntity");     
                        String location = getLocation(docID, con);
                        long fieldID = rs.getLong("fieldID");
                        String fieldValue = rs.getString("fValue");
                        DlicApp doc = null;
                        if (dlicDocs.containsKey(String.valueOf(docID))) {
                             doc = (DlicApp)dlicDocs.get(String.valueOf(docID));
                        } else {
                             doc = new DlicApp();
                        doc.setId(docID);
                        doc.setDocName(docName);
                        doc.setReferenceNo(refNo);
                        doc.setCreateDate(createDate);
                        doc.setCreator(creator);
                        doc.setProfileType(profileType);
                        doc.setAssunto(assunto);
                        doc.setFrom(fromEntity);
                        //if (doc.getStartDate() == null) {                    
                        //     doc.setStartDate(createDate);
                        doc.setLocation(location);
                        if (fieldValue != null) {                    
                             if (fieldID == 1114) {
                                  doc.setChineseName(fieldValue);
                             if (fieldID == 1115) {
                                  doc.setPortugueseName(fieldValue);
                             if (fieldID == 1116) {
                                  doc.setApplicationCategory(fieldValue);
                             if (fieldID == 1118) {
                                  doc.setStatus(fieldValue);
                             if (fieldID == 1119) {
                                  Date d = DMSUtil.parseDate(fieldValue, "yyyy-MM-dd");
                                  doc.setStartDate(d);
                                  hasStartDate = true;
                             if (fieldID == 1120) {
                                  Date d = DMSUtil.parseDate(fieldValue, "yyyy-MM-dd");
                                  if (!StringUtils.isEmpty(fieldValue)) {
                                       //System.out.println(docName + ":" + fieldValue + ">>>>>>>>>findDlicApp>>>>>>>>>>>>>>>>>>APP END DATE: " + d);
                                       doc.setEndDate(d);
                        if (docID != lastDocID) {                    
                             doc.setRelatedDocs(findRelatedDoc(docID, con));
                             lastDocID = docID;
                        dlicDocs.put(String.valueOf(docID), doc);
                   stmt.close();
                   rs.close();
                   Iterator<String> its = dlicDocs.keySet().iterator();
                   while(its.hasNext()) {
                        String id = (String)its.next();
                        DlicApp a = (DlicApp)dlicDocs.get(id);
                        a.setRelatedDocs(findRelatedDoc(a.getId(), con));
                        dlicDocs.put(id, a);
                   result.addAll(dlicDocs.values());
                   // take out start date is not in the given period
                   int n = 0;
                   while(true) {
                        if (n < result.size()) {
                             DlicApp a = (DlicApp)result.get(n);               
                             Date sd = a.getStartDate();
                             if (!isWithin(sd, startDate, endDate)) {
                                  result.remove(n);
                             } else {
                                  n++;
                        } else {
                             break;
              } catch(Exception e) {
                   e.printStackTrace();
              if (result.size() > 0) {
                   Collections.sort(result, new DmsDocComparator());
              return result;
         }Edited by: EJP on 13/01/2011 14:41: added code tags for you. Please use them next time.

  • PL/SQL named parameters

    When editing a PL/SQL package I can type a package body name and "." and get a list of function/procedures to choose from. When I choose a function/procedure from the list I would like jdeveloper to dump out the function call complete with named parameters similar to the way it generates an anonymous block for you when you choose to run a function or procedure. How does one do this.
    Thanks in advance.

    Hi,
    the best way is to check this feature being avaiable in SQL Developer because JDeveloper 11 will consume their code base for the integrated PSLQL development environment. Let me know if you can't find it in there and I'll fiel an enhancement request against SQL Developer
    Frank

  • How can I copy a Font Book library with "Collections" to my 2nd laptop?

    How can I copy a Font Book library with "Collections" to my 2nd laptop?
    I have a number of fonts (approx. 500) on my work laptop which are sorted to different Collections. I'd like to have a copy of the Font Book library with Collections on the laptop I use at home to work. I'd think there was a more straight forward way to do it, but I haven't found any posts regarding the matter so any help would be appreciated.
    Thanks

    To anyone who is reading this based on needing to copy their Font Book to another machine as I do, there is a way to make a copy of the fonts in Font Book by going to file/export fonts. Keep in mind that you will need to have all the fonts selected (command A) in your "All Fonts" list for them to be exported. You will then have a new folder saved to where ever you chose, with all your Font Book fonts in it.

  • EJB 3.0: How to merge detached entity with collection

    Hello,
    suppose you have 2 database tables: PARENT and CHILD with one-to-many association. In a session bean you load the parent entity together with collection of children and send it all to client. Client might change parent or child data, add/remove children.
    Now back in a session bean you want to update database, so you call:
    entityManager.merge(detached_parent_entity);Problem is, that removed child objects from entity bean collection are not deleted from database. Bacause I am currently using Hibernate, I could follow the FAQ (http://www.hibernate.org/116.html#A17) and add delete-orphan cascade, but I don't want to be tight to Hibernate nor other frameworks.
    Is there any sexy solution?
    Thanks for replies!

    I'm afarid not - a generic feature that will allow to
    delete orphan children didn't make it into the final
    spec.
    regards,
    -marinaDo you happen to have any links to public discussions about this feature with regard to the development of the spec? This is a very nice feature in Hibernate and it's absence in EJB 3.0 is rather disappointing.
    Thanks.

  • RE: multiple named objects with the same name andinterface

    David,
    First I will start by saying that this can be done by using named anchored
    objects and registering them yourself in the name service. There is
    documentation on how to do this. And by default you will get most of the
    behavior you desire. When you do a lookup in the name service (BindObject
    method) it will first look in the local partition and see if there is a
    local copy and give you that copy. By anchoring the object and manually
    registering it in the name service you are programmatically creating your
    own SO without defining it as such in the development environment. BTW in
    response to your item number 1. This should be the case there as well. If
    your "mobile" object is in the same partition where the service object he is
    calling resides, you should get a handle to the local instance of the
    service object.
    Here is the catch, if you make a bind object call and there is no local copy
    you will get a handle to a remote copy but you can not be sure which one!
    It end ups as more or less a random selection. Off the top of my head and
    without going to the doc, I am pretty sure that when you register an
    anchored object you can not limit it's visibility to "User".
    Sean
    -----Original Message-----
    From: [email protected]
    [<a href="mailto:[email protected]">mailto:[email protected]]On</a> Behalf Of David Foote
    Sent: Monday, June 22, 1998 4:51 PM
    To: [email protected]
    Subject: multiple named objects with the same name and interface
    All,
    More than once, I have wished that Forte allowed you to place named
    objects with the same name in more than one partition. There are two
    situations in which this seems desirable:
    1) Objects that are not distributed, but are mobile (passed by value to
    remote objects), cannot safely reference a Service Object unless it has
    environment visibility, but this forces the overhead of a remote method
    call when it might not otherwise be necessary. If it were possible to
    place a copy of the same Service Object (with user visibility) in each
    partition, the overhead of a remote method call could be avoided. This
    would only be useful for a service object whose state could be safely
    replicated.
    2) My second scenario also involves mobile objects referencing a Service
    Object, but this time I would like the behavior of the called Service
    Object to differ with the partition from which it is called.
    This could be accomplished by placing Service Objects with the same name
    and the same interface in each partition, but varying the implementation
    with the partition.
    Does anyone have any thoughts about why this would be a good thing or a
    bad thing?
    David N. Foote
    Consultant
    Get Your Private, Free Email at <a href=
    "http://www.hotmail.com">http://www.hotmail.com</a>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:<a href=
    "http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:<a href=
    "http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>

    David,
    First I will start by saying that this can be done by using named anchored
    objects and registering them yourself in the name service. There is
    documentation on how to do this. And by default you will get most of the
    behavior you desire. When you do a lookup in the name service (BindObject
    method) it will first look in the local partition and see if there is a
    local copy and give you that copy. By anchoring the object and manually
    registering it in the name service you are programmatically creating your
    own SO without defining it as such in the development environment. BTW in
    response to your item number 1. This should be the case there as well. If
    your "mobile" object is in the same partition where the service object he is
    calling resides, you should get a handle to the local instance of the
    service object.
    Here is the catch, if you make a bind object call and there is no local copy
    you will get a handle to a remote copy but you can not be sure which one!
    It end ups as more or less a random selection. Off the top of my head and
    without going to the doc, I am pretty sure that when you register an
    anchored object you can not limit it's visibility to "User".
    Sean
    -----Original Message-----
    From: [email protected]
    [<a href="mailto:[email protected]">mailto:[email protected]]On</a> Behalf Of David Foote
    Sent: Monday, June 22, 1998 4:51 PM
    To: [email protected]
    Subject: multiple named objects with the same name and interface
    All,
    More than once, I have wished that Forte allowed you to place named
    objects with the same name in more than one partition. There are two
    situations in which this seems desirable:
    1) Objects that are not distributed, but are mobile (passed by value to
    remote objects), cannot safely reference a Service Object unless it has
    environment visibility, but this forces the overhead of a remote method
    call when it might not otherwise be necessary. If it were possible to
    place a copy of the same Service Object (with user visibility) in each
    partition, the overhead of a remote method call could be avoided. This
    would only be useful for a service object whose state could be safely
    replicated.
    2) My second scenario also involves mobile objects referencing a Service
    Object, but this time I would like the behavior of the called Service
    Object to differ with the partition from which it is called.
    This could be accomplished by placing Service Objects with the same name
    and the same interface in each partition, but varying the implementation
    with the partition.
    Does anyone have any thoughts about why this would be a good thing or a
    bad thing?
    David N. Foote
    Consultant
    Get Your Private, Free Email at <a href=
    "http://www.hotmail.com">http://www.hotmail.com</a>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:<a href=
    "http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:<a href=
    "http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>

Maybe you are looking for

  • How do I combine two pdf documents into one using preview?

    If I remember correctly I have done this in the past but now I can't remember how to do it. Message was edited by: admiral_koa i finally found some other questions like mine which got answered. So I'm closing this out.

  • PL/SQL Bulk Loading

    Hello, I have one question regarding bulk loading. I did lot of bulk loading. But my requirement is to call function which will do some DML operation and give ref key so that i can insert to fact table. Because i can't use DML function in select stat

  • Why is my wi fi greyed out?

    why is my wifi greyed out on my ipod touch?  i have tried system restore and reset settings. nothing seems to be working.

  • Need to default file association to Indesign CS2

    Hello, I am using a PC/XP sp2, and i have both adobe cs1, cs2, and cs3 installed sequentially. I need to default all .indd files to open with Indesign CS2 instead of cs3 from the window explorer. However, that's not happening at all. I have tried to

  • How to adjust the brightness of an apple monitor from Windows 7?

    how to adjust the brightness of an apple monitor from Windows 7?