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

Similar Messages

  • Running a SQL Stored Procedure from Power Query with Dynamic Parameters

    Hi,
    I want to execute a stored procedure from Power Query with dynamic parameters.
    In normal process, query will look like below in Power Query. Here the value 'Dileep' is passed as a parameter value to SP.
        Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData 'Dileep'"]
    Now I want to pass the value dynamically taking from excel sheet. I can get the required excel cell value in a variable but unable to pass it to query.
        Name_Parameter = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        Name_Value = Name_Parameter{0}[Value],
    I have tried like below but it is not working.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData Name_Value"]
    Can anyone please help me with this issue.
    Thanks
    Dileep

    Hi,
    I got it. Below is the correct syntax.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData '" & Name_Value & "'"]
    Thanks
    Dileep

  • How to write XSJS Select Query with input parameters

    Hello Experts,
    I am creating a xsjs file and in that file I am trying to write a Select Query based on a Calculation View
    I have tried it the following way:
    var query = 'SELECT TOP 100 \"Name\", \"Address\", \"City\", \"Country\" FROM \"_SYS_BIC\".\"Test.HL/AddressView\"'
        + 'WITH PARAMETERS(\'PLACEHOLDER\' = (\'$$P_Name$$\', \' Akhil \'),'
      + '\'PLACEHOLDER\' = (\'$$P_City$$\', \' Lucknow \'))';
    But it gives me the "Mixed spaces and tabs error".
    How should I write XSJS Select Query with input parameters?
    Regards,
    Rohit

    >But it gives me the "Mixed spaces and tabs error".
    Mixed spaces and tabs has nothing to do with the syntax of the statement. You used both spaces and the tab in the content - which JSLint doesn't like.  Remove the beginning spaces of each line and use only one or the other.
    The actual syntax of your statement doesn't look right.  The problem is that you are escaping the \ when you don't need to if you are using ' instead of " for your string.  You escape with \" in the first line but then escape with \' in the 2nd and 3rd line.  That is going to cause serious parsing problems with the command.

  • Extract Sql Query with Actual Parameters from Report

    Hi
    I am able to extract query from Crystal Report using the following code :
    ReportDocument.ReportClientDocument.RowSetController.GetSqlStatement(new GroupPath, out tmp);
    But the sql query retrieve comes in the following format :
    select name , trans_code, account_code from command_query.accounts
    where account_code = {?Command_query_Prompt0}  and effective_date < '{?Command_query_prompt1 }'
    The parameters which I m using in the reports are :
    Account_Code and Effective_Date .
    Why does my extracted sql translates it into {?Command_query_Prompt0} and '{?Command_query_prompt1 }' .
    Is there any way to map this to the actual parameter values ?
    OR
    Can we extract the query after assigning the values ?
    Any help is appreciated ... 
    Thanks
    Sanchet

    hi,
    You can create nested sql query with conditional parameters,
    For example
    Select Code From OITT Where Code IN (Select ItemCode From OITM
    Where ItemName LIKE '[%0]' + '%%')
    Edited by: Jeyakanthan A on Jun 9, 2009 12:31 PM

  • Named query with join tables

    I have two tables
    - Process_Master (EVENT_ID, EVENT_TYP, STATUS)
    - Rel_Event( EVENT_ID, USERID, EVENT_DATE, RMKS)
    They have one-to-one relationship linked by EVENT_ID.
    I would like to create a named query like below joining 2 tables together.
    Do I need to create any class descriptor first and how? I want this query to be available from the ADF data control so I can drag and drop this to my JSP page as a ADF table. I have no problem in working with single table. I have read thru the developer guide and try out many things like multitable info, aggregate mapping and couldn't figure out how this can be done. Please help!!!
    SELECT A.EVENT_ID,B.EVENT_DATE, A.STATUS, B.RMKS
    FROM PROCESS_MASTER A, REL_EVENT B
    WHERE A.EVENT_ID = B.EVENT_ID
    AND A.STATUS = 'P';
    ********/

    I have tried the below but fail to retrieve any rows. Please help!
    Expression aid = new ExpressionBuilder(ProcEventMaster.class).get("event_id");
    Expression bid = new ExpressionBuilder(RelEvent.class).get("event_id");
    ReportQuery reportQuery = new ReportQuery(ProcEventMaster.class,aid.equal(bid));
    reportQuery.addAttribute("a_id", aid);
    reportQuery.addAttribute("b_id", bid);
    reportQuery.addAttribute("eventDate",bid.get("event_date"));
    reportQuery.addAttribute("remarks",bid.get("rmks"));
    reportQuery.setSelectionCriteria(aid.get("status").equal("P"));
    List<RelEvent> results =
    (List<RelEvent>)session.executeQuery(reportQuery);session.release();
    return results;

  • Create Named Query with no descriptor?

    I have a very simple query(see below). I'd like to use it as a named query instead of recreating it everytime. I wonder if there is a way I can add it to somewhere without using a descriptor so that I can retrevie it from the session.
    Thanks,
    Wei
    ValueReadQuery query = new ValueReadQuery();
    query.setSQLString("SELECT SYSDATE FROM DUAL");
    Object obj = (Object) session.executeQuery(query);

    There is an "addQuery(DatabaseQuery q)" on the Session interface that should do the trick. So create your session, and then do:
    ValueReadQuery query = new ValueReadQuery();
    query.setSQLString("SELECT SYSDATE FROM DUAL");
    session.addQuery("getDate", query);
    Then later you should be able to:
    session.executeQuery("getDate");
    - Don

  • Content presenter: datasource based on CMIS query with URL parameters

    Hi all,
    I am trying to create a page containing a content presenter taskflow that is based on a CMIS query containing URL parameters. In my component properties I define the following query for my datasource:
    +SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xqblIntranetSubGroep='${param.qblSubGroep}'+
    I have a URL parameter qblSubGroep containing the value "Nieuws".
    Somehow my page does not show any content. It looks like the parameter value is not passed to the data source query. When I change my query to
    SELECT * FROM ora:t:IDC:GlobalProfile WHERE ora:p:xqblIntranetSubGroep='Nieuws'
    so, I hardcode the value of my URL parameter in my query, the expected content items are shown.
    Also, I have another page containing a content presenter taskflow for a single item, based on the data source:
    +${'WebCenterSpaces-UCM#dDocName:'}${param.dDocName}+
    In this case, URL parameter values for dDocName are passed correctly and content presenter is showing the document with dDocName as entered in the URL.
    Does anybody have any idea on how to solve this probem?
    regards,
    Harold

    hi all
    when i try using cmis query with Arabic characters it display no results .
    SELECT * FROM ora:t:IDC:GlobalProfile WHERE AND ora:p:xAgrPressMag LIKE'جريدة الرياض'
    this is the query i am using and the value inside ora:p:xAgrPressMag is correct and i try search this value inside content presenter normal search and it display results i am afraid that cmis query doesnt accept arabic characters
    any suggestion please its top urgent
    best regards
    Edited by: 975169 on Feb 26, 2013 12:59 AM

  • MDM ABAP API: Query with Multiple Parameters

    I would like to query MDM repository passing multiple parameters. I used the following code, however, it didn't work.
    If I pass only one parameter, it works fine.
    DATA lt_query                  TYPE mdm_query_table.
    DATA ls_query                 TYPE mdm_query.
    DATA lv_search_text       TYPE string.
    DATA lt_result_set            TYPE mdm_search_result_table.
    DATA ls_result_set           LIKE LINE OF lt_result_set.
    * Fill query structure with FIRST parameter
        ls_query-parameter_code  = 'Name'.
        ls_query-operator        = 'CS'. 
        ls_query-dimension_type  = mdmif_search_dim_field.    
        ls_query-constraint_type = mdmif_search_constr_text.
        lv_search_text = 'BMW'.
        GET REFERENCE OF lv_search_text INTO ls_query-value_low.
        APPEND ls_query TO lt_query.
    * Fill query structure with SECOND parameter
        ls_query-parameter_code  = 'Model'.
        ls_query-operator        = 'CS'. 
        ls_query-dimension_type  = mdmif_search_dim_field.    
        ls_query-constraint_type = mdmif_search_constr_text.
        lv_search_text = '2009'.
        GET REFERENCE OF lv_search_text INTO ls_query-value_low.
        APPEND ls_query TO lt_query.
    * Query on records (search for value 'BMW' model '2009' in table Products)
        CALL METHOD lr_api->mo_core_service->query
          EXPORTING
            iv_object_type_code = 'Products'                  
            it_query            = lt_query
          IMPORTING
            et_result_set       = lt_result_set.

    Hi,
    I see you are not clearing your local structure "ls_query".  This could be reason of problem,  try this and let us know the result:
    DATA lt_query                  TYPE mdm_query_table.
    DATA ls_query                 TYPE mdm_query.
    DATA lv_search_text       TYPE string.
    DATA lt_result_set            TYPE mdm_search_result_table.
    DATA ls_result_set           LIKE LINE OF lt_result_set.
    Fill query structure with FIRST parameter
        ls_query-parameter_code  = 'Name'.
        ls_query-operator        = 'CS'. 
        ls_query-dimension_type  = mdmif_search_dim_field.    
        ls_query-constraint_type = mdmif_search_constr_text.
        lv_search_text = 'BMW'.
        GET REFERENCE OF lv_search_text INTO ls_query-value_low.
        APPEND ls_query TO lt_query.
    CLEAR ls_query.
    Fill query structure with SECOND parameter
        ls_query-parameter_code  = 'Model'.
        ls_query-operator        = 'CS'. 
        ls_query-dimension_type  = mdmif_search_dim_field.    
        ls_query-constraint_type = mdmif_search_constr_text.
        lv_search_text = '2009'.
        GET REFERENCE OF lv_search_text INTO ls_query-value_low.
        APPEND ls_query TO lt_query.
    CLEAR ls_query.
    Query on records (search for value 'BMW' model '2009' in table Products)
        CALL METHOD lr_api->mo_core_service->query
          EXPORTING
            iv_object_type_code = 'Products'                  
            it_query            = lt_query
          IMPORTING
            et_result_set       = lt_result_set.

  • How to construct query with null parameters in jpa 2.0

    Hi,
    I am creating a jpa 2.0 application. I have an entity with a large number of fields
    @Entity
    @Table(name="notations")
    public class Notation implements Serializable {
         private static final long serialVersionUID = 1L;
         @Id
         private Integer id;
         @Column(name="action_count")
         private Integer actionCount;
         @Column(name="adaptability_comment")
         private String adaptabilityComment;
         @Column(name="adaptability_score")
         private Integer adaptabilityScore;
         private String comment;
         @Column(name="compatibility_comment")
         private String compatibilityComment;
         @Column(name="compatibility_score")
         private Integer compatibilityScore;
         @Column(name="consistency_comment")
         private String consistencyComment;
         @Column(name="consistency_score")
         private Integer consistencyScore;
         @Column(name="controlpoint_name")
         private String controlpointName;
         @Column(name="device_brand")
         private String deviceBrand;
         @Column(name="device_name")
         private String deviceName;
         @Column(name="error_management_comment")
         private String errorManagementComment;
         @Column(name="error_management_score")
         private Integer errorManagementScore;
         @Column(name="explicit_control_comment")
         private String explicitControlComment;
         @Column(name="explicit_control_score")
         private Integer explicitControlScore;
         @Column(name="functionality_name")
         private String functionalityName;
         @Column(name="guidance_comment")
         private String guidanceComment;
         @Column(name="guidance_score")
         private Integer guidanceScore;
         @Column(name="is_available")
         private Boolean isAvailable;
         private String protocol;
         @Column(name="significance_comment")
         private String significanceComment;
         @Column(name="significance_score")
         private Integer significanceScore;
         @Column(name="tester_name")
         private String testerName;
         @Column(name="use_case_name")
         private String useCaseName;
         @Column(name="workload_comment")
         private String workloadComment;
         @Column(name="workload_score")
         private Integer workloadScore;
            getters, settersI am using a method to update this entity as the user changes different fields. My method takes (almost) all fields, but only one (or few) have values, the others are null.
    public Notation updateNotation(Integer id, Boolean isAvailable, String protocol, String deviceBrand,
                   String deviceName,String testerName, Date ratingDate, String functionalityName,
                   String useCaseName,     String controlPointName, Integer actionCount, String comment,
                   Integer adaptabilityScore, Integer compatibilityScore, Integer consistencyScore,
                   Integer errorManagementScore, Integer explicitControlScore, Integer guidanceScore, Integer significanceScore,
                   Integer workloadScore, String adaptabilityComment, String compatibilityComment,
                   String consistencyComment, String errorManagementComment, String explicitControlComment,
                   String guidanceComment, String significanceComment, String workloadComment) throws PersistenceException{
              String setString = "";
              if(isAvailable != null)
                   setString += "n.isAvailable = '" + isAvailable + "',";
              if(!(protocol==null||protocol.isEmpty()))
                   setString += "n.protocol = '" + protocol + "',";
              if(!(deviceBrand==null||deviceBrand.isEmpty()))
                   setString += "n.deviceBrand = '" + deviceBrand + "',";
              if(!(deviceName==null||deviceName.isEmpty()))
                   setString += "n.deviceName = '" + deviceName + "',";
              if(!(testerName==null||testerName.isEmpty()))
                   setString += "n.testerName = '" + testerName + "',";
              if(!(functionalityName==null||functionalityName.isEmpty()))
                   setString += "n.functionalityName = '" + functionalityName + "',";
              if(!(useCaseName==null||useCaseName.isEmpty()))
                   setString += "n.useCaseName = '" + useCaseName + "',";
              if(!(controlPointName==null||controlPointName.isEmpty()))
                   setString += "n.controlPointName = '" + controlPointName + "',";
              if(actionCount != null)
                   setString += "n.actionCount = '" + actionCount + "',";
              if(!(comment==null||comment.isEmpty()))
                   setString += "n.comment = '" + comment + "',";
              if(adaptabilityScore != null)
                   setString += "n.adaptabilityScore = '" + adaptabilityScore + "',";
              if(compatibilityScore != null)
                   setString += "n.compatibilityScore = '" + compatibilityScore + "',";
              if(consistencyScore != null)
                   setString += "n.consistencyScore = '" + consistencyScore + "',";
              if(errorManagementScore != null)
                   setString += "n.errorManagementScore = '" + errorManagementScore + "',";
              if(explicitControlScore != null)
                   setString += "n.explicitControlScore = '" + explicitControlScore + "',";
              if(guidanceScore != null)
                   setString += "n.guidanceScore = '" + guidanceScore + "',";
              if(significanceScore != null)
                   setString += "n.significanceScore = '" + significanceScore + "',";
              if(workloadScore != null)
                   setString += "n.workloadScore = '" + workloadScore + "',";
              if(!(adaptabilityComment==null||adaptabilityComment.isEmpty()))
                   setString += "n.adaptabilityComment = '" + adaptabilityComment + "',";
              if(!(compatibilityComment==null||compatibilityComment.isEmpty()))
                   setString += "n.compatibilityComment = '" + compatibilityComment + "',";
              if(!(consistencyComment==null||consistencyComment.isEmpty()))
                   setString += "n.consistencyComment = '" + consistencyComment + "',";
              if(!(errorManagementComment==null||errorManagementComment.isEmpty()))
                   setString += "n.errorManagementComment = '" + errorManagementComment + "',";
              if(!(explicitControlComment==null||explicitControlComment.isEmpty()))
                   setString += "n.explicitControlComment = '" + explicitControlComment + "',";
              if(!(guidanceComment==null||guidanceComment.isEmpty()))
                   setString += "n.guidanceComment = '" + guidanceComment + "',";
              if(!(significanceComment==null||significanceComment.isEmpty()))
                   setString += "n.significanceComment = '" + significanceComment + "',";
              if(!(workloadComment==null||workloadComment.isEmpty()))
                   setString += "n.workloadComment = '" + workloadComment + "',";
              if(setString!="") setString = setString.substring(0, setString.length()-1);
              String queryString = "UPDATE Notation n SET " + setString + " WHERE n.id = ?1";
              Query q = em.createQuery(queryString);
              q.setParameter(1, id);
              q.executeUpdate();
              return (Notation) em.createQuery("SELECT n FROM Notation n WHERE n.id = ?1").setParameter(1, id).getResultList().get(0);
         }So my question I think is somewhat obvious. What is a good way to construct my query, so that I am not forced to have such an ugly and laborious code (again, knowing that most of the arguments are null)?
    Thanks in advance
    Edited by: StefanC on Jan 27, 2010 3:01 AM

    That is a good point, I will do the operations directly on the entity. However, that still doesn't save me from having to write all those if statements and having an ugly code.
    Husain.AlKhamis wrote:
    Exactly, this is the concept behind JPA --> you have to write zero SQL queries.It's true that you don't have to write any queries for update and remove, however you still have to write JPQL queries (pretty much like SQL) to selections.

  • Query with input parameters (as int)

    Hello all,
    I am trying to run the following query but i keep getting the following message:
    Conversion failed when converting the varchar value '[%0]' to data type int.
    in SQL 2005.
    I understand what the error is saying i just cant find a way to pass a parameter as a int?
    Any help would be appreciated.
    declare @PONum int
    declare @DocEntry int
    declare @POLine int
    declare @WONum int
    declare @WOLine int
    SELECT @PONum = T0.DocNum FROM OPOR T0 WHERE T0.DocNum = '[%0]'
    SELECT @DocEntry = T1.DocEntry FROM OPOR T1 WHERE DocNum  =  @PONum
    SELECT @POLine = T2.LineNum FROM POR1 T2 WHERE T2.DocEntry = @DocEntry and T2.LineNum  = '[%1]'
    select @WONum = T3.U_WO from [@CDIJCHDR] T3 WHERE T3.U_WO = '[%2]'
    select @WOLine = T4.U_Line from [@CDIJCHDR] T4 WHERE T4.U_WO = @WONum and T4.U_Line ='[%3]'
    Update [@CDIPOWO]
    set   [@CDIPOWO].U_WO = @WONum,
           [@CDIPOWO].U_WOLine = @WOLine
    where [@CDIPOWO].U_PO = @PONum
      and [@CDIPOWO].U_POLine = @POLine
      and [@CDIPOWO].U_QtyRecvd = 0
    and @WONum > 0
    update [@CDIJCEST]
    set [@CDIJCEST].U_WO = @WONum,
         [@CDIJCEST].U_Line = @WOLine
    from [@CDIJCEST]
    where [@CDIJCEST].U_3DREF = 'P'
       and [@CDIJCEST].U_3DDocNum = @PONum
       and [@CDIJCEST].U_3DDocLn = @POLine
       and @WONum > 0
    -Chuck

    Hi Charles,
    Where are you running this query (ie SBO or SQL Management Studio)? This is exactly the error you will get if you try running this query in SQL Management Studio, outside of SBO. This is because [%0] is SBO syntax and is not recognised as a parameter in SQL.
    Kind Regards,
    Owen

  • Query with SPASCRIPT parameters

    Hi Champs,
    I am creating a SAP SCRIPT which will be clone of MR_PRINT and will be driven by TCode MR90. Hence I cannot make changed in the driver program.
    In my requirement I need one more field to be represented in my SAP Script that is VTEXT(payment terms) field of LFM1. But when I debug the existing MR_PRINT SAPSCRIPT it seems as if there is no parameter like LFM1-VTEXT.
    My Query is is it possible to create your own parameter in SAP Script and then Populate it.
    I know there a syntax
    /: DEFINE &lfm1-vtext& *
    But can this varibale be used for display purpose.
    Thanks
    Regards
    Nishant

    Hi Nishant,
    you can add your desired field in SAPACRIPT.
    you need to write subroutine program for this.
    e.g.
    perform get_quant_char in ZMM_TRANSFER_ORDER using intab structure itscy.
    FORM GET_QUANT_CHAR TABLES INTAB STRUCTURE ITCSY
                               OUTTAB STRUCTURE ITCSY.
      DATA : QUANT(13) TYPE C,
             QUANT1 TYPE I.
      READ TABLE INTAB INDEX 1.
      QUANT1 = INTAB-VALUE .
      QUANT = QUANT1.
      CONDENSE QUANT.
      READ TABLE OUTTAB INDEX 1.
      OUTTAB-VALUE = QUANT.
      MODIFY OUTTAB INDEX 1.
    ENDFORM.                    "Get_quant_Char
    Regards,
    Vijay

  • TopLink - Get sql code of a Named Query.

    Hi everyone!
    I'm wrinting to yours because I want to insert into a register of a table of my database the sql code generated of a named query. I mean, I have a named query with sql code, and I want to get that sql with the parameters that I used to execute that query.
    What would I do to get that information..??..
    I'll be wainting your responses.
    Thanks!
    Greetings, Lucho!

    You might want to ask this on the TopLink Forum.
    TopLink has levels of logging that will provide you with the queries executed.
    That said, if you want to log each operation on a table at the database level, then maybe looking into the database audit features would make more sense.

  • 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

  • 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

  • Named Query impacting SSAS Cube Performance

    HI,
    I have created a Named Query that impacts the Cube Processing and its performance. Can anyone please suggest how can we replace named query with any other logic.
    Thanks

    Hello,
    if the data source is SQL Server then you could use the named query statement to create a view there; but it won't change the performance of the query. So check the execution plan of the query to see if you could improve it.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

Maybe you are looking for