Variable nr of params in SQLJ

Hi,
I'm using SQLJ for some time now, and it works great.. There is however something that I can't seem to do in SQLJ..
Suppose my query is the following:
SELECT * FROM table WHERE nr IN (3,5,6);
How can I do this in SQLJ and have 3,5,6 come from java? (it must be a variable number of numbers)
I was thinking something along the lines of:
int numbers[];
#sql { SELECT * FROM table WHERE nr IN (:numbers) };
But this doesn't seem to work. Anybody any idea?
Greetings,
Ivo
null

Sorry, it can't be done - SQLJ only supports static SQL with a fixed number of bind variables. You could revert to JDBC along the following lines:
String nums = ...; //comma-separated list of numbers
Connection conn = DefaultContext.getDefaultContext().getConnection();
Statement s = conn.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM table WHERE nr IN ("+nums+")");
If you want to use the result set as a SQLJ iterator, you can do so as follows.
MySqljIterator it;
#sql it = { CAST :rs };
it.close(); // also closes rs
If you know that you have at most a handful (i.e. 5 or so) of numbers, you could also write 5 different SQLJ statements binding between 1 and 5 numbers.
-- Ekkehard

Similar Messages

  • How to set Bind variable on the action of command link

    I have two tables. One is the list of processes and other one is the details of processes with process name as primary key.
    I want to first display the first table which has the list of processes on one page. When I click on perticular process name this process will pass to the bind variable of another table and corresponding details will be shown on other page. can anyone help how I can do this. My code is as follows:
    package model;
    import model.common.BpelDetailsView;
    import oracle.jbo.server.ViewObjectImpl;
    public class BpelDetailsViewImpl extends ViewObjectImpl implements BpelDetailsView {
    * This is the default constructor (do not remove).
    public BpelDetailsViewImpl() {
    * Returns the variable value for bpelnameVar.
    * @return variable value for bpelnameVar
    public String getbpelnameVar() {
    return (String)ensureVariableManager().getVariableValue("bpelnameVar");
    * Sets <code>value</code> for variable bpelnameVar.
    * @param value value to bind as bpelnameVar
    public void setbpelnameVar(String value) {
    ensureVariableManager().setVariableValue("bpelnameVar", value);
    this.executeQuery();
    <af:commandLink id="ot3" text="#{row.BpelName}"
    action="#{DasboardBean.ot3_action}"/>
    public String ot3_action() {
    BpelDetailsViewImpl bdv=new BpelDetailsViewImpl();
    bdv.setbpelnameVar("#{row.BpelName}");
    return "success";
    but its not working at all.
    Its displaying the errors on click of command link.
    javax.servlet.ServletException: java.lang.NullPointerException
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
         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:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
         at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
         at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
         at org.apache.myfaces.trinidad.component.UIXCollection.broadcast(UIXCollection.java:147)
         at org.apache.myfaces.trinidad.component.UIXTable.broadcast(UIXTable.java:271)
         at oracle.adf.view.rich.component.UIXTable.broadcast(UIXTable.java:140)
         at oracle.adf.view.rich.component.rich.data.RichTable.broadcast(RichTable.java:364)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:87)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:298)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:91)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:87)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:87)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:298)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:91)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:81)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:673)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:273)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:165)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         ... 34 more
    Caused by: java.lang.NullPointerException
         at oracle.jbo.server.ComponentObjectImpl.ensureVariableManager(ComponentObjectImpl.java:472)
         at model.BpelDetailsViewImpl.setbpelnameVar(BpelDetailsViewImpl.java:32)
         at portal.view.bean.DasboardBean.ot3_action(DasboardBean.java:24)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
         at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
         at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
         ... 54 more

    Hi Shay..
    Thanx for your help...
    I stuck in one more problem. When I run directly the first list page it works fine. I craeted one more page home.jspx where I added a golink with <af:golink id="gl1" text ="List" destination="list.jspx". When I click on link it opens the list page. Now when I clicking on first column its redirecting to list.jspx not to details.jspx.
    What can be the solution for this.

  • About find param's value order

    file "doc/readme.html"
    at "Parameter Resolution" said:
    "the XSQL Page Processor determines the value of the parameter by using the following logic.
    If the request is being processed by the XSQL Servlet, then check in the following order if myParam is the name of...
    An XSQL local page parameter
    An HTTP Cookie
    An HTTP Session Variable
    An HTTP Request Parameter
    but at "Producing Dynamic XML Documents from SQL Queries" (about page 40) said:"The XSQL Page Processor will first consult the HTTP request parameters (or command-line parameters) for a matching parameter named paramname and if found, it will use that value. If not found among the HTTP request parameters, it will search for XML attributes on the current <xsql:query> element, and its ancestor elements until reaching the document root. "
    there is a different,why?

    There is no conflict here.
    The parameter value resolution order is as stated:
    [list=1]
    [*]Local page parameter (not the same as an XML attribute)
    [*]HTTP Cookie
    [*]HTTP Session Variable
    [*]HTTP Request Param
    [list]
    and then, if none of these matches, it uses an attribute of the same name as the parameter as a "fallback" or "default" value if it can find one on the current action element or one of its ancestors.
    null

  • How to use in clause with variable elements with a prepared statement?

    Is there any way to use a prepared statement for a query which incorporates an in clause with unknown number of elements in the list?
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Iraj ():
    Is there any way to use a prepared statement for a query which incorporates an in clause with unknown number of elements in the list?<HR></BLOCKQUOTE>
    Sorry, can't be done. The PreparedStatement is precomplied, so you can't have variable number of params or unknown number of elements in a list.

  • Variable Partagée OverFlow (Erreur -2221)

    Bonjour,
    J'utilise LabView 2011 avec un Module cRio 9025.
    J'ai programmé une 1ère tache déterministe Cadencée à 1 ms / Priorité 500 => Cette boucle acquière 19 mesures à 1Khz.
    J'ai programmé une 2ème tache non deterministe Cadencée à 10 ms / Priorité 100 => Cette boucle gère l'enregistrement des 19 mesures dans 3 fichiers différents (chacun ayant une fonction particulière)
    Le transfert des données entre la boucle déterministe et non déterministe se fait par le biais d'une variable partagée paramètrée avec : 
    - Tableau Double 1D / Un processus
    - Fifo RT : nombre de tableaux = 11 / Nombre d'éléments = 19.
    Quand j'exécutes mon programme un overflow se produit dans la boucle déterministe (env 7000 en 1 min).
    Je cherche des pistes pour l'éviter.
    Dans un 1er temps j'ai désactiver toutes les fonctions "Écriture dans un fichier ASCII" et effectivement plus aucun OverFlow ne se produit.
    Ayant identifié la source du problème je suis passé au format d'enregistrement Binaire. Dans ce cas, j'ai effectivement 2 fois moins d'erreur 3785 overflow en binaire au lieu de 6623 en ASCII.
    Je précise que dans la boucle non determinste la fermeture et l'ouverture des fichiers ne se font que lorsque un nombre de lignes est atteint. Dans les autre cas, je ne fais que de l'enregistrement.
    Sur quel autre paramètre puis-je interagir pour éviter le phénomène ?
    D'avance merci beaucoup pour votre nombreuses pistes.
    CAPRA - KB

    Bonjour,
    En bleu les réponses aux questions.
    Merci.
    ===============================
    Comment est faite la lecture de la variable partagée dans la boucle non déterministe?
    => On "Dépile" la variable partagée, puis on enregistre.
    On répete la structure ci-dessus jusqu'à atteindre le code -2220. Dans ce dernier cas, on purge l'erreur puis on recommence.
    Est-ce que vous lisez une donnée à chaque itération?
    => Oui on lit une donnée à chaque itération à savoir 1 tableau de 19 mesures.
    Ou est-ce que vous venez vider l'ensemble de la fifo de la variable en attendant une erreur d'underflow?
    =>Non
    Il est important que vous veniez vide l'ensemble de la FIFO à chaque itération de la boucle non déterministe.
    Ensuite, vous devez regarder comment l'enregistrement est le plus efficace. Est-il préférable de lire les données et de les enregistrer une par une, et de réitérer cela jusqu'à ce que la fifo soit vide, ou est-il préférable de venir lire tous les éléments de la fifo, puis de tout enregistrer d'un coup dans le fichier (je pense que l'appel au fichier une seule fois par itération est préférable).
    => Je vais faire un essai d'enregistrement unique de plusieur iteration jusqu'a ce que la FIFO soit vide. Merci pour cette proposition.
    Enfin, si malgré cela, le temps d'écriture du fichier est encore un peu juste, il est peut-être préférable de grossir un peu la taille de la FIFO.
    => Y'a-t-il une méthode pour choisir la taille de la FIFO ? J'ai peur de mettre une valeur trop grande et de me rendre compte après qqes heures de fonctionnement que ça n'a pas suffit... Y'a-t-il l'equivalent d'un "scan backlog" <=> "nombre de points encore disponibles" dans la FIFO ? sachant que la variable partagée a été créée à partir d'un projet....
    Cordialement,
    Olivier L. | Certified LabVIEW Developer

  • ValueRef and scope variables

    It seems that the valueRef attribute is always associated to a bean variable.
    If I want to use scope variables like in JSTL I have to use the rtexprvalue="true" for valueRef.
    Can the variables pageScope, sessionScope, param, etc. be reserved so that they can be accessed
    thru valueRef?
    E.g. <h_output_text valueRef="pageScope.mySSN" /> or use the JSTL syntax:
    <h_output_text valueRef="${pageScope.mySSN}" />
    Does somebody know the rationale behind valueRef being limited to beans exclusively?

    I am not very clear abot this, but maybe it is because of some issue in making the Faces Components
    device-independent.
    Perhaps, you can try using <c:set> to copy the data from page-scope bean to a managed bean
    and then use the managed bean property in the valueRef.
    Ajay

  • SSRS - Is there a multi thread safe way of displaying information from a DataSet in a Report Header?

     In order to dynamically display data in the Report Header based in the current record of the Dataset, we started using Shared Variables, we initially used ReportItems!SomeTextbox.Value, but we noticed that when SomeTextbox was not rendered in the body
    (usually because a comment section grow to occupy most of the page if not more than one page), then the ReportItem printed a blank/null value.
    So, a method was defined in the Code section of the report that would set the value to the shared variable:
    public shared Params as String
    public shared Function SetValues(Param as String ) as String
    Params = Param
    Return Params 
    End Function
    Which would be called in the detail section of the tablix, then in the header a textbox would hold the following expression:
    =Code.Params
    This worked beautifully since, it now didn't mattered that the body section didn't had the SetValues call, the variable persited and the Header displayed the correct value. Our problem now is that when the report is being called in different threads with
    different data, the variable being shared/static gets modified by all the reports being run at the same time. 
    So far I've tried several things:
    - The variables need to be shared, otherwise the value set in the Body can't be seen by the header.
    - Using Hashtables behaves exactly like the ReportItem option.
    - Using a C# DLL with non static variables to take care of this, didn't work because apparently when the DLL is being called by the Body generates a different instance of the DLL than when it's called from the header.
    So is there a way to deal with this issue in a multi thread safe way?
    Thanks in advance!
     

    Hi Angel,
    Per my understanding that you want to dynamic display the group data in the report header, you have set page break based on the group, so when click to the next page, the report hearder will change according to the value in the group, when you are using
    the shared variables you got the multiple thread safe problem, right?
    I have tested on my local environment and can reproduce the issue, according to the multiple safe problem the better way is to use the harshtable behaves in the custom code,  you have mentioned that you have tryied touse the harshtable but finally got
    the same result as using the ReportItem!TextBox.Value, the problem can be cuased by the logic of the code that not works fine.
    Please reference to the custom code below which works fine and can get all the expect value display on every page:
    Shared ht As System.Collections.Hashtable = New System.Collections.Hashtable
    Public Function SetGroupHeader( ByVal group As Object _
    ,ByRef groupName As String _
    ,ByRef userID As String) As String
    Dim key As String = groupName & userID
    If Not group Is Nothing Then
    Dim g As String = CType(group, String)
    If Not (ht.ContainsKey(key)) Then
    ' must be the first pass so set the current group to group
    ht.Add(key, g)
    Else
    If Not (ht(key).Equals(g)) Then
    ht(key) = g
    End If
    End If
    End If
    Return ht(key)
    End Function
    Using this exprssion in the textbox of the reportheader:
    =Code.SetGroupHeader(ReportItems!Language.Value,"GroupName", User!UserID)
    Links belowe about the hashtable and the mutiple threads safe problem for your reference:
    http://stackoverflow.com/questions/2067537/ssrs-code-shared-variables-and-simultaneous-report-execution
    http://sqlserverbiblog.wordpress.com/2011/10/10/using-custom-code-functions-in-reporting-services-reports/
    If you still have any problem, please feel free to ask.
    Regards
    Vicky Liu

  • Error while assigning values to Array using Copy operation

    Hi,
    I am using the following code to copy a string value 'Text' and 'UDFTypeTitle' to the 1st and 2nd position of an array:-
    <assign name="Assign1">
    <copy>
    <from expression="string('Text')"/>
    <to variable="Invoke1_ReadUDFValues_InputVariable" part="params"
    query="/ns1:ReadUDFValues/ns1:Field[position()=1]"/>
    </copy>
    <copy>
    <from expression="string('UDFTypeTitle')"/>
    <to variable="Invoke1_ReadUDFValues_InputVariable" part="params"
    query="/ns1:ReadUDFValues/ns1:Field[position()=2]"/>
    </copy>
    </assign>
    I am getting the following error for the 2nd copy:-
    XPath query string returns zero node.
    The assign activity of the to node query is returning zero node.
    Either the to node data or the xpath query in the to node was invalid.
    According to BPEL4WS spec 1.1 section 14.3, verify the to node value at line number 103 in the BPEL source
    If I am removing the 2nd copy I am not getting any error.
    The structure of ns1:*ReadUDFValues* is as follows:-
    - <xsd:complexType name="ReadUDFValues">
    - <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="Field" type="tns:UDFValueFieldType" />
    <xsd:element minOccurs="0" name="Filter" type="xsd:string" />
    <xsd:element minOccurs="0" name="OrderBy" type="xsd:string" />
    </xsd:sequence>
    </xsd:complexType>
    The structure of ns1:ReadUDFValues/ns1:*Field* is as follows:-
    xsd:simpleType name="UDFValueFieldType">
    - <xsd:restriction base="xsd:string">
    <xsd:enumeration value="CodeValue" />
    <xsd:enumeration value="ConditionalIndicator" />
    <xsd:enumeration value="Cost" />
    <xsd:enumeration value="CreateDate" />
    <xsd:enumeration value="CreateUser" />
    <xsd:enumeration value="Description" />
    <xsd:enumeration value="Double" />
    <xsd:enumeration value="FinishDate" />
    <xsd:enumeration value="ForeignObjectId" />
    <xsd:enumeration value="Indicator" />
    <xsd:enumeration value="Integer" />
    <xsd:enumeration value="IsBaseline" />
    <xsd:enumeration value="IsTemplate" />
    <xsd:enumeration value="IsUDFTypeCalculated" />
    <xsd:enumeration value="IsUDFTypeConditional" />
    <xsd:enumeration value="LastUpdateDate" />
    <xsd:enumeration value="LastUpdateUser" />
    <xsd:enumeration value="ProjectObjectId" />
    <xsd:enumeration value="StartDate" />
    <xsd:enumeration value="Text"/>
    <xsd:enumeration value="UDFCodeObjectId" />
    <xsd:enumeration value="UDFTypeDataType" />
    <xsd:enumeration value="UDFTypeObjectId" />
    <xsd:enumeration value="UDFTypeSubjectArea" />
    <xsd:enumeration value="UDFTypeTitle"/>
    </xsd:restriction>
    </xsd:simpleType>
    Could you please suggest a solution?
    I also tried with position 0, 1 . still the same error.
    Regards,
    Sam

    Hi Naresh,
    The structure of ReadUDFValues is as follows:-
    - <xsd:complexType name="ReadUDFValues">
    - <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="Field" type="tns:UDFValueFieldType" />
    <xsd:element minOccurs="0" name="Filter" type="xsd:string" />
    <xsd:element minOccurs="0" name="OrderBy" type="xsd:string" />
    </xsd:sequence>
    </xsd:complexType>
    The structure of ns1:ReadUDFValues/ns1:Field is as follows:-
    xsd:simpleType name="UDFValueFieldType">
    - <xsd:restriction base="xsd:string">
    <xsd:enumeration value="CodeValue" />
    <xsd:enumeration value="ConditionalIndicator" />
    <xsd:enumeration value="Cost" />
    <xsd:enumeration value="CreateDate" />
    <xsd:enumeration value="CreateUser" />
    <xsd:enumeration value="Description" />
    <xsd:enumeration value="Double" />
    <xsd:enumeration value="FinishDate" />
    <xsd:enumeration value="ForeignObjectId" />
    <xsd:enumeration value="Indicator" />
    <xsd:enumeration value="Integer" />
    <xsd:enumeration value="IsBaseline" />
    <xsd:enumeration value="IsTemplate" />
    <xsd:enumeration value="IsUDFTypeCalculated" />
    <xsd:enumeration value="IsUDFTypeConditional" />
    <xsd:enumeration value="LastUpdateDate" />
    <xsd:enumeration value="LastUpdateUser" />
    <xsd:enumeration value="ProjectObjectId" />
    <xsd:enumeration value="StartDate" />
    <xsd:enumeration value="Text"/>
    <xsd:enumeration value="UDFCodeObjectId" />
    <xsd:enumeration value="UDFTypeDataType" />
    <xsd:enumeration value="UDFTypeObjectId" />
    <xsd:enumeration value="UDFTypeSubjectArea" />
    <xsd:enumeration value="UDFTypeTitle"/>
    </xsd:restriction>
    </xsd:simpleType>

  • Error in weblogic7.0 :java.security.NoSuchAlgorithmException:

    Hi All
    thanks in advance.
    i am facing a peculiar problem while using SunJce provider
    i have some classes to encrypt& decrypt some information using
    DeffieHellman protocol.
    Problem 1
    while i am running those classes in command prompts
    some time it gives me correct results where as other time during decryption i am unable to get the plaintext (i am getting some junk character),where as some time it gives me Badpadding exception
    I am using JDK1.3 which comes with weblogic and jce1.2.2
    for classpath and path setting
    set path=D:\bea\jdk131_03\bin
    set classpath=%classpath%; D:\bea\jdk131_03\jre\lib\ext\ jce1_2_2.jar
    set classpath=%classpath%; D:\bea\jdk131_03\jre\lib\ext\sunjce_provider.jar
    set classpath=%classpath%; D:\bea\jdk131_03\jre\lib\ext\local_policy.jar
    set classpath=%classpath%; D:\bea\jdk131_03\jre\ext\US_export_policy.jar
    my BEA_HOME=d\bea and JAVA_HOME=D:\bea\jdk131_03\jre
    Problem 2
    While i am using those classes in servlet and jsp which are deployed in weblogic 7
    Some time i am getting correct results
    but as i stop and start the weblogic server ,i am getting .NoSuchAlgorithmException.
    So mainly i am having two classes DiffieHellmanKeyGeneRation and DHEncryptDecrypt given below
    import java.io.*;
    import java.math.BigInteger;
    import java.security.*;
    import java.security.spec.*;
    import java.security.interfaces.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import javax.crypto.interfaces.*;
    import com.sun.crypto.provider.SunJCE;
    public class DiffieHellmanKeyGeneRation {
    PublicKey alicePubKey=null;
         PublicKey bobPubKey=null;
         KeyAgreement aliceKeyAgree =null;
         KeyAgreement bobKeyAgree =null;
    * DiffieHellmanKeyGeneRation() constructor -Set the mode and call run method to generate Keypairs
    * and assigns it to the instance variables .
    * @param nil
    * @returns nil
    public DiffieHellmanKeyGeneRation(){
         try {
    String mode = "GENERATE_DH_PARAMS";
                   run(mode);
    } catch (Exception e) {
    System.err.println("Error: " + e);
    System.exit(1);
    * getAlicePubKey() -Return the Instance Variable alicePubKey
    * @param nil
    * @returns PublicKey
    public PublicKey getAlicePubKey()
    return alicePubKey;
    * getBobPubKey() -Return the Instance Variable bobPubKey
    * @param nil
    * @returns PublicKey
    public PublicKey getBobPubKey()
    return bobPubKey;
    * getAliceKeyAgree() -Return the Instance Variable aliceKeyAgree
    * @param nil
    * @returns KeyAgreement
         public KeyAgreement getAliceKeyAgree()
    return aliceKeyAgree;
    * getBobKeyAgree() -Return the Instance Variable bobKeyAgree
    * @param nil
    * @returns KeyAgreement
    public KeyAgreement getBobKeyAgree()
    return bobKeyAgree;
    *run() method -Generate Algorithm instance,KeySpec,and keypair
    * and assigns it to the instance variables .
    * @param String
    * @returns nil
    private void run(String mode) throws Exception {
    DHParameterSpec dhSkipParamSpec=null;
    // System.out.println("Creating Diffie-Hellman parameters (takes VERY long) ...");
    AlgorithmParameterGenerator paramGen=AlgorithmParameterGenerator.getInstance("DH");
    paramGen.init(512);
    AlgorithmParameters params = paramGen.generateParameters();
    dhSkipParamSpec = (DHParameterSpec)params.getParameterSpec(DHParameterSpec.class);
    * Alice creates her own DH key pair, using the DH parameters from
    * above
    // System.out.println("ALICE: Generate DH keypair ...");
    KeyPairGenerator aliceKpairGen = KeyPairGenerator.getInstance("DH");
    aliceKpairGen.initialize(dhSkipParamSpec);
    KeyPair aliceKpair = aliceKpairGen.generateKeyPair();
    // Alice creates and initializes her DH KeyAgreement object
    // System.out.println("ALICE: Initialization ...");
    aliceKeyAgree = KeyAgreement.getInstance("DH");
    aliceKeyAgree.init(aliceKpair.getPrivate());
    // Alice encodes her public key, and sends it over to Bob.
    byte[] alicePubKeyEnc = aliceKpair.getPublic().getEncoded();
    * Let's turn over to Bob. Bob has received Alice's public key
    * in encoded format.
    * He instantiates a DH public key from the encoded key material.
    KeyFactory bobKeyFac = KeyFactory.getInstance("DH");
    X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(alicePubKeyEnc);
    alicePubKey = bobKeyFac.generatePublic(x509KeySpec);
    * Bob gets the DH parameters associated with Alice's public key.
    * He must use the same parameters when he generates his own key
    * pair.
    DHParameterSpec dhParamSpec = ((DHPublicKey)alicePubKey).getParams();
    // Bob creates his own DH key pair
    // System.out.println("BOB: Generate DH keypair ...");
    KeyPairGenerator bobKpairGen = KeyPairGenerator.getInstance("DH");
    bobKpairGen.initialize(dhParamSpec);
    KeyPair bobKpair = bobKpairGen.generateKeyPair();
    // Bob creates and initializes his DH KeyAgreement object
    // System.out.println("BOB: Initialization ...");
    bobKeyAgree = KeyAgreement.getInstance("DH");
    bobKeyAgree.init(bobKpair.getPrivate());
    // Bob encodes his public key, and sends it over to Alice.
    byte[] bobPubKeyEnc = bobKpair.getPublic().getEncoded();
    * Alice uses Bob's public key for the first (and only) phase
    * of her version of the DH
    * protocol.
    * Before she can do so, she has to instanticate a DH public key
    * from Bob's encoded key material.
    KeyFactory aliceKeyFac = KeyFactory.getInstance("DH");
    x509KeySpec = new X509EncodedKeySpec(bobPubKeyEnc);
    bobPubKey = aliceKeyFac.generatePublic(x509KeySpec);
    2)
    import java.io.*;
    import java.math.BigInteger;
    import java.security.*;
    import java.security.spec.*;
    import java.security.interfaces.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import javax.crypto.interfaces.*;
    import sun.misc.*;
    import com.sun.crypto.provider.SunJCE;
    public class DHEncryptDecrypt {
    PublicKey alicePubKey=null;
         PublicKey bobPubKey=null;
         KeyAgreement aliceKeyAgree =null;
         KeyAgreement bobKeyAgree =null;
         SecretKey bobDesKey = null;
         SecretKey aliceDesKey =null;
    * DHEncryptDecrypt constructor -it intancetiate DiffieHellmanKeyGeneRation object to get Public key of both party and Shared Secrete
    * and assigns it to the instance variables .
    * @param nil
    * @returns nil
         public DHEncryptDecrypt()
              try{
              init();
         }catch(Exception e){e.printStackTrace();}
    * init() -it DiffieHellmanKeyGeneRation object to get Public key of both party and Shared Secrete
    * and assigns it to the instance variable ds.
    * @param nil
    * @returns nil
    private void init() throws Exception
         System.out.println("Initialising...");
                   DiffieHellmanKeyGeneRation dhPubKey=new DiffieHellmanKeyGeneRation();
                   alicePubKey=dhPubKey.getAlicePubKey();
                   bobPubKey=dhPubKey.getBobPubKey();
    aliceKeyAgree=dhPubKey.getAliceKeyAgree();
                   bobKeyAgree=dhPubKey.getBobKeyAgree();
    //System.out.println("ALICE: Execute PHASE1 ...");
    aliceKeyAgree.doPhase(bobPubKey, true);
         * Bob uses Alice's public key for the first (and only) phase
         * of his version of the DH
         * protocol.
    // System.out.println("BOB: Execute PHASE1 ...");
    bobKeyAgree.doPhase(alicePubKey, true);
    * At this stage, both Alice and Bob have completed the DH key
    * agreement protocol.
    * Both generate the (same) shared secret.
    byte[] aliceSharedSecret = aliceKeyAgree.generateSecret();
    int aliceLen = aliceSharedSecret.length;
    byte[] bobSharedSecret = new byte[aliceLen];
    int bobLen;
    /* try {
    // show example of what happens if you
    // provide an output buffer that is too short
    bobLen = bobKeyAgree.generateSecret(bobSharedSecret, 1);
    } catch (ShortBufferException e) {
    System.out.println(e.getMessage());
    // provide output buffer of required size
    bobLen = bobKeyAgree.generateSecret(bobSharedSecret, 0);
              if (!java.util.Arrays.equals(aliceSharedSecret, bobSharedSecret))
    throw new Exception("Shared secrets differ");
    //System.out.println("Shared secrets are the same");
    // System.out.println("Return shared secret as SecretKey object ...");
    // Bob
    // Note: The call to bobKeyAgree.generateSecret above reset the key
    // agreement object, so we call doPhase again prior to another
    // generateSecret call
    bobKeyAgree.doPhase(alicePubKey, true);
    bobDesKey = bobKeyAgree.generateSecret("DES");
    // Alice
    // Note: The call to aliceKeyAgree.generateSecret above reset the key
    // agreement object, so we call doPhase again prior to another
    // generateSecret call
    aliceKeyAgree.doPhase(bobPubKey, true);
    aliceDesKey = aliceKeyAgree.generateSecret("DES");
    * encrypt() - Alice encrypts, using DES in ECB mode
    * and assigns it to the instance variable ds.
    * @param String
    * @returns String
              public String encrypt(String ClearText) throws Exception
         String CipherText=null;
                   try{
                   // byte[] iv = {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF,(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF};
              Cipher aliceCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
         aliceCipher.init(Cipher.ENCRYPT_MODE, aliceDesKey);
                   byte[] cleartext = ClearText.getBytes();
                   //System.out.println("cleartext Array:"+ cleartext.size);
                   byte[] ciphertext = aliceCipher.doFinal(cleartext);
    // BASE64Encoder b64e = new BASE64Encoder();
                   //CipherText = b64e.encode(ciphertext);
                   CipherText = new String(ciphertext);
                   }catch(Exception e){e.printStackTrace();}
         return CipherText;
    * encrypt() - Bob Decrypts, using DES in ECB mode
    * and assigns it to the instance variable ds.
    * @param String
    * @returns String
    public String decrypt(String CipherText) throws Exception
    String Recovered=null;
         try{
              // byte[] iv = {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF,(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF};
    // System.out.println("Length of String is:"+CipherText.length());
                   Cipher bobCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
              bobCipher.init(Cipher.DECRYPT_MODE, bobDesKey);
                   byte[] CipherTextBytes=CipherText.getBytes();
    byte[] recovered = bobCipher.doFinal(CipherTextBytes);
                   Recovered=new String(recovered);
              // System.out.println("Decryption:"+Recovered+"length:="+Recovered.length());
    }catch(Exception e){e.printStackTrace();}
         return Recovered;
    and i am using following logic to encrypt and decrypt
    String MyPlainText ="sm_user=residential&csol_account=383784";
    //String MyPlainText ="This is my message";
         System.out.println("\nPlain Text:="+MyPlainText+"\n\n");
    try{
         DHEncryptDecrypt ed=new DHEncryptDecrypt();
    String CipherText=(ed.encrypt(MyPlainText));
                   BASE64Encoder b64e = new BASE64Encoder();
                   String CipherText1 = b64e.encode(CipherText.getBytes());
    System.out.println("\n\nUserInfo="+CipherText1);
         String DecryptedMessage=ed.decrypt(CipherText);
    System.out.println("\n\nDecrypedMessage=:"+DecryptedMessage);
         }catch(Exception e){e.printStackTrace();}
    and my java.security file in D:\ bea\jdk131_03\jre\lib\security
    is changed to add the provider as
    # List of providers and their preference orders (see above):
    security.provider.1=sun.security.provider.Sun
    security.provider.2=com.sun.crypto.provider.SunJCE
    security.provider.3=com.sun.rsajca.Provider
    # Class to instantiate as the system Policy. This is the name of the class
    # that will be used as the Policy object.
    policy.provider=sun.security.provider.PolicyFile
    Pls help me to resolve the magic shown by these classes.....some time right and some time worng
    mainly i need help in
    Badpadding Exception and NosuchAlogorithm exception in weblogic
    Thanks
    And regards
    Arati

    replace all calls of getBytes() and new String(text) with the versions where you can state a charset: getBytes(charset), new String(text, charset). i use "iso-8859-1" as the charset.
    this should at least fix your "Badpadding exception" problem (it did fix it for me).

  • Error while creating own BAPI

    Hey,
    trying this step-by-step guide with own names
    http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
    Got two errors:
    1. In SWO1 while trying to add api methods he said:
    BAPI &1: The name of the function module &2 does not begin with 'BAPI'
    BAPI &1: BAPI function module &2 has no return parameter
    Searching in forum, I found that my structures have to begin with ZBAPI. But
    why the tutorial can do this? In tutorial the structure is named ZVEND. Why they
    can do this?
    2. The second error is telling me, that I have no return parameter. Thats not true.
    In my export tab of my function module, I have included a Parameter BAPIRET2 TYPE BAPIRET2.
    Trying to insert a table like this:
    RETURN TYPE BAPIRETURN
    He is telling me that "TABLES parameters are obsolete"
    In every tutorial they are using like, but I am not able to use LIKE, only TYPE is this something they changed in the SAP version > 4.7 ???
    Does every BAPI needs a return structure or table?
    If anyone have some good documents about how to create an own bapi let me know.
    But please no short description or 1000 links like this: how to create our own bapi?
    thanks
    chris
    thx
    chris

    Hi,
    Here are the answers for your queries.  (Version 4.7)
    1.  The function module name should start with "ZBAPI" the
         one we are creating our own.
         All the structures we refer for parameters in function moudle
         should also start with "ZBAPI"
         (eg., Import Params: VBELN LIKE ZVBAK-VBELN).
    2.  There must be a return parameter in Export List in the
         function module like the one below. Its a BAPI standard
         return variable.
         Export Params:RETURN LIKE ZBAPIRETURN.
         In BAPI Function modules we pass parameters as "pass
         by value". That's why Tables are not used as they are
         passed by reference.
    Hope it helps you
    Murthy.

  • How to Customize the Web item " Text Elements"in WAD

    Hi All,
    Can any one let me know how to customize the web item TEXT ELEMENTS. When we place the web item Text element in the web template, it displays the query details and the info provider details.
    I question is I do not want to list all the list that is displayed in the text elements. I want to see only part of the list....can any one whether this is possible or not..if possible how...?
    Thanks in Advance,
    Hash

    yes you need to specify the variable name
    <object>
             <param name="OWNER" value="SAP_BW"/>
             <param name="CMD" value="GET_ITEM"/>
             <param name="NAME" value="TEXTELEMENTS_1"/>
             <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_TEXT_ELEMENTS"/>
             <param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>
             <param name="GENERATE_CAPTION" value="BORDER"/>
             <param name="GENERATE_LINKS" value=""/>
             <param name="SHOW_COMMON_ELEMENTS" value=""/>
            <b> <param name="ELEMENT_TYPE_1" value="VARIABLE"/>
             <param name="ELEMENT_NAME_1" value="0H_CCTR"/></b>         ITEM:            TEXTELEMENTS_1
    </object>
    Regards
    Raja

  • Passing parameters from jsp to xslt

    Hi all,
    I am trying to pass a variable string from a jsp to xslt .
    This is the code in the jsp which passes the variables .
    <c:set var="xsl">
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:import href="<%= "service_attribute.xsl" %>"/>
    <xsl:variable name="ItemId"><%= ItemId %></xsl:variable>
    <xsl:variable name="pos"><%= pos %></xsl:variable>
    <xsl:variable name="lineInfoTn"><%= lineInfoTn %></xsl:variable>
    </xsl:stylesheet>
    </c:set>
    <x:transform xmlSystemId="foo.xml" xslt="${xsl}">
    <%= FM.getOrderBean().getXml("ActivationRequest") %>
    </x:transform>
    In the service_attribute.xsl I would like to be able to check the lineInfoTn variable for content .
    something like this .
    <xsl:if test="$lineInfoTn='10pt'">
    <!-- Do something -->
    <xsl:value-of select="$lineInfoTn"/>
    </xsl:if>
    The first problem is that it complains that the $lineInfoTn is not declared .
    So I added the variable as a global variable .
    <xsl:param name="lineInfoTn">10pt</xsl:param>
    Note I have been switching between variables and parameters to try and get this working .
    I can use the itemId variable like this and I dont have a problem .
    <xsl:for-each select="q:RequestItem/q:ItemId[text() = $ItemId]/..">
    Any ideas on how to get this working .
    Thanks for your help

    Thanks for the input

  • URL Parameterizing for BI Query Detail Drill Down via Xcelsius

    Hi Guys,
    I am In the process of building an Xcelsius dashboard using BI/BW as my source system, working on a "Details" URL button to allow the user to drill directly into the source BI queries with their current combo box selections. 
    I am trying to build a URL to pass a value to both a variable and to filter a characteristic. I want to pass a value to a 0fiscper variable and exclude an employee number. 
    I have been able to get each URL to work independently, but not working together. If I leave out either the variable part or the filter part it works, but it doesn't work with both the filter portion and characteristic filter section. 
    I followed other threads and used Web application designer (WAD) instructions to view the XHTML I will have to parametrize for my URL.
    This is how I have flattened/parametrized it
    Variable part:
    BI_COMMAND_1-BI_COMMAND_TYPE=SET_VARIABLES_STATE&
    BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE_TYPE=VARIABLE_INPUT_STRING&
    BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE_TYPE-VARIABLE_INPUT_STRING=010/2010&
    BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE=BCURFPER&
    data provider part
    BI_COMMAND_1-BI_COMMAND_TYPE=SET_SELECTION_STATE&
    BI_COMMAND_1-TARGET_DATA_PROVIDER_REF_LIST-TARGET_DATA_PROVIDER_REF_1=DP_1&
    characteristic filter part
    BI_COMMAND_1-CHARACTERISTICS_SELECTIONS-CHARACTERISTIC_SELECTIONS_1-CHARACTERISTIC=0EMPLOYEE&
    BI_COMMAND_1-CHARACTERISTICS_SELECTIONS-CHARACTERISTIC_SELECTIONS_1-SELECTIONS-SELECTION_1-SELECTION_INPUT_STRING=!201
    So my complete URL is:
    http://serverinfo?
    QUERY=ABCQUERY&
    BI_COMMAND_1-BI_COMMAND_TYPE=SET_VARIABLES_STATE&
    BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE_TYPE=VARIABLE_INPUT_STRING&
    BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE_TYPE-VARIABLE_INPUT_STRING=010/2010&
    BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE=BCURFPER&
    BI_COMMAND_1-BI_COMMAND_TYPE=SET_SELECTION_STATE&
    BI_COMMAND_1-TARGET_DATA_PROVIDER_REF_LIST-TARGET_DATA_PROVIDER_REF_1=DP_1&
    BI_COMMAND_1-CHARACTERISTICS_SELECTIONS-CHARACTERISTIC_SELECTIONS_1-CHARACTERISTIC=0EMPLOYEE&
    BI_COMMAND_1-CHARACTERISTICS_SELECTIONS-CHARACTERISTIC_SELECTIONS_1-SELECTIONS-SELECTION_1-SELECTION_INPUT_STRING=!201
    Then it gives me the following error when I attempt to run this...
    " The metadata of "CMD" "SET_VARIABLES_STATE" are incorrect for parameter "CHARACTERISTICS_SELECTIONS"
    If I set the debug=x flag to see what is generated in the error this is the info I get:
    The parameter "CHARACTERISTICS_SELECTIONS" in the metadata of "CMD" "SET_VARIABLES_STATE is not correctly defined:
    <parameterList>
      <param name="BI_COMMAND_TYPE" value="SET_VARIABLES_STATE"/>
      <param name="CHARACTERISTICS_SELECTIONS">
        <param name="CHARACTERISTIC_SELECTIONS" index="1">
          <param name="CHARACTERISTIC" value="0EMPLOYEE"/>
          <param name="SELECTIONS">
            <param name="SELECTION" modification_type="delete_if_value_not_equal" index="1">
              <param name="SELECTION_INPUT_STRING" value="!201"/>
            </param>
          </param>
        </param>
      </param>
      <param name="TARGET_DATA_PROVIDER_REF_LIST">
        <param name="TARGET_DATA_PROVIDER_REF" value="DP_1" index="1"/>
      </param>
      <param name="TARGET_VARIABLE_CONTAINER_REF" value="DEFAULT"/>
      <param name="VARIABLE_VALUES">
        <param name="VARIABLE_VALUE" index="1">
          <param name="VARIABLE" value="BCURFPER"/>
          <param name="VARIABLE_TYPE" value="VARIABLE_INPUT_STRING" modification_type="delete_if_value_not_equal">
            <param name="VARIABLE_INPUT_STRING" value="010/2010"/>
          </param>
        </param>
      </param>
    </parameterList>
    Thanks for looking!
    -Gary

    Hi Gary,
    We came across the following issue.Colud you please provide the solution which you used to resolve it.
    " The metadata of "CMD" "SET_ITEM_PARAMETERS" are incorrect for parameter "BUTTON_LIST".
    Thanks,
    Anji

  • Converting Name-Value pair to XML

    Hi,
    I have configured the proxy service to listen for "&" delimited HTTP post string. I have been able to tokenize the "&" delimited string and get the name-value pair as below:
    ============================================================
    <CUSTOMER>
    <param name="amp;STATE_NAME" value="abc_test" />
    <param name="amp;EMAIL_ADDRESS" value="[email protected]" />
    </CUSTOMER>
    =====================================================
    Now I want to convert this name-value pair into XML format to comply with the xml schema. Kindly suggest the way how can this be achieved?

    Hi Hisaak,
    Thanks for the pointer But I am not able to access the Name-Value pair to form the desired XML.
    The output of first action is below and assigned to "payload" variable.
    ================================================
    <query-params>
    <param name="Model1" value="model1_test"/>
    <param name="Option1" value="option1_test"/>
    <param name="Quantity1" value="quantity1_test"/>
    </query-params>
    =================================================
    In second assign action , I have used your given code and assigned to "Order" variable.
    =====================================================
    <Order>
    <Model1>{$payload//param[@name = Model1]/@value}</Model1>
    <Options1>{$payload//param[@name = Options1]/@value}</Options1>
    <Quantity1>{$payload//param[@name = Quantity1]/@value}</Quantity1>
    <Model2>{$payload//param[@name = Model2]/@value}</Model2>
    </Order>
    =====================================================
    But after testing , I got the following output:
    ================================
    <Order>
    <Model1/>
    <Options1/>
    <Quantity1/>
    <Model2/>
    </Order>
    ====================================
    The values didn't update. Let me know if I am missing anything.

  • Java.io.NotSerializableException WHY??? What did I do??? ;-)

    Hi Guys,
    I am getting java.io.NotSerializableException when running a query and
    passing in PersistenceCapable object via executeWithMap or
    executeWithArray. When I run the same query and pass the object in
    directly into execute()(as a single parameter), it works just fine... ???
    I am using Kodo version 2.4.2. To pass the parameters in I have tried
    HashMap as well as normal array (ArrayList.toArray()) and always got the
    problem.
    The code and full stack is bellow. Please note the test for
    PersistenceCapable. Part of the code is commented out, but it still throws
    the exception as it is.
    Any help would be greatly appretiated!!!
    Petr
    Code:
    String ql = "folderItems.contains(vfolderItem) && vfolderItem.parentFolder
    == parFolder";
              String params = "Folder parFolder";
              String variables = "FolderItem vfolderItem;";
              HashMap parValues = new HashMap();
              System.out.println("Folder PC" + (folder instanceof PersistenceCapable));
              parValues.put("parFolder", folder);
              if (createdStart != null) {
                   ql = ql + " && createdDate >= padStartDate";
                   params = params + ", java.util.Date padStartDate";
                   parValues.put("padStartDate", createdStart);
              if (createdStop != null) {
                   ql = ql + " && createdDate <= padStopDate";
                   params = params + ", java.util.Date padStopDate";
                   parValues.put("padStopDate", createdStop);
              if (receivedBy != null ) {
                   ql = ql + " && recipients.contains(vRecipient) &&
    vRecipient.recipientType == parRecipient";
                   params = params + ", CodeValue parRecipient";
                   variables = variables + "; Recipient vRecipient;";
                   parValues.put("parRecipient", receivedBy);
              if (sentBy != null) {
                   ql = ql + " && recipients.contains(vSender) && vSender.recipientType ==
    parSender";
                   params = params + ", CodeValue parSender";
                   variables = variables + "; Recipient vSender;";
                   parValues.put("parSender", sentBy);
              Collection col;
              Query q = ctx.getPersist().newQuery(ext, ql);
              q.declareVariables(variables);
              q.declareParameters(params);
              q.declareImports("import com.mallesons.servicenet.aa.folder.*;");
              q.setOrdering("createdDate ascending");
              q.compile();
              col = (Collection) q.executeWithMap(parValues);
              //col = (Collection) q.execute(folder);
    Stack:
    javax.jdo.JDOFatalUserException:
    com.mallesons.servicenet.aa.folder.Folder: java.util.HashMap
    NestedThrowables:
    java.io.NotSerializableException: com.mallesons.servicenet.aa.folder.Folder
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.serialize(AbstractDictionary.java:684)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.blobToSQL(AbstractDictionary.java:384)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.blobToPreparedParameter(AbstractDictionary.java:1067)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.SQLServerDictionary.blobToPreparedParameter(SQLServerDictionary.java:139)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.toPreparedParameter(AbstractDictionary.java:808)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLValue.applyParameter(SQLValue.java:129)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:239)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:222)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.prepareStatementInternal(SQLExecutionManagerImpl.java:824)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedQueryInternal(SQLExecutionManagerImpl.java:761)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQueryInternal(SQLExecutionManagerImpl.java:691)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecutionManagerImpl.java:372)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecutionManagerImpl.java:356)
         at
    com.solarmetric.kodo.impl.jdbc.ormapping.ClassMapping.selectPrimaryMappings(ClassMapping.java:1221)
         at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.executeQuery(JDBCStoreManager.java:707)
         at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.executeQuery(JDBCQuery.java:93)
         at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:792)
         at
    com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:668)
         at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:609)
         at
    com.mallesons.servicenet.ta.shared.BOQuery.executeWithMap(BOQuery.java:159)
         at
    com.mallesons.servicenet.aa.folder.SearchEmailItemService.searchDirect(SearchEmailItemService.java:105)
         at
    com.mallesons.servicenet.aa.folder.SearchEmailItemService.searchIn(SearchEmailItemService.java:45)
         at
    com.mallesons.servicenet.aa.folder.test.SearchItemServiceTest.testCascadeFaxNoTime(SearchItemServiceTest.java:217)
         at java.lang.reflect.Method.invoke(Native Method)
         at junit.framework.TestCase.runTest(TestCase.java:166)
         at junit.framework.TestCase.runBare(TestCase.java:140)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:131)
         at junit.framework.TestSuite.runTest(TestSuite.java:173)
         at junit.framework.TestSuite.run(TestSuite.java:168)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:329)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:218)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:151)
    NestedThrowablesStackTrace:
    java.io.NotSerializableException: com.mallesons.servicenet.aa.folder.Folder
         at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1205)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:383)
         at java.util.HashMap.writeObject(HashMap.java:825)
         at java.lang.reflect.Method.invoke(Native Method)
         at
    java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java:1925)
         at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1267)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:383)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.serialize(AbstractDictionary.java:680)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.blobToSQL(AbstractDictionary.java:384)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.blobToPreparedParameter(AbstractDictionary.java:1067)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.SQLServerDictionary.blobToPreparedParameter(SQLServerDictionary.java:139)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.toPreparedParameter(AbstractDictionary.java:808)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLValue.applyParameter(SQLValue.java:129)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:239)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:222)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.prepareStatementInternal(SQLExecutionManagerImpl.java:824)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedQueryInternal(SQLExecutionManagerImpl.java:761)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQueryInternal(SQLExecutionManagerImpl.java:691)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecutionManagerImpl.java:372)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecutionManagerImpl.java:356)
         at
    com.solarmetric.kodo.impl.jdbc.ormapping.ClassMapping.selectPrimaryMappings(ClassMapping.java:1221)
         at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.executeQuery(JDBCStoreManager.java:707)
         at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.executeQuery(JDBCQuery.java:93)
         at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:792)
         at
    com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:668)
         at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:609)
         at
    com.mallesons.servicenet.ta.shared.BOQuery.executeWithMap(BOQuery.java:159)
         at
    com.mallesons.servicenet.aa.folder.SearchEmailItemService.searchDirect(SearchEmailItemService.java:105)
         at
    com.mallesons.servicenet.aa.folder.SearchEmailItemService.searchIn(SearchEmailItemService.java:45)
         at
    com.mallesons.servicenet.aa.folder.test.SearchItemServiceTest.testCascadeFaxNoTime(SearchItemServiceTest.java:217)
         at java.lang.reflect.Method.invoke(Native Method)
         at junit.framework.TestCase.runTest(TestCase.java:166)
         at junit.framework.TestCase.runBare(TestCase.java:140)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:131)
         at junit.framework.TestSuite.runTest(TestSuite.java:173)
         at junit.framework.TestSuite.run(TestSuite.java:168)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:329)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:218)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:151)

    OK, mystery solved. I was using a our internal wrapper around Query and
    who ever wrote it, mapped executeWithArray and executeWithMap to simple
    Query.execute.
    Damn! :-(
    Petr
    Petr Bulanek wrote:
    Hi Guys,
    I am getting java.io.NotSerializableException when running a query and
    passing in PersistenceCapable object via executeWithMap or
    executeWithArray. When I run the same query and pass the object in
    directly into execute()(as a single parameter), it works just fine... ???
    I am using Kodo version 2.4.2. To pass the parameters in I have tried
    HashMap as well as normal array (ArrayList.toArray()) and always got the
    problem.
    The code and full stack is bellow. Please note the test for
    PersistenceCapable. Part of the code is commented out, but it still throws
    the exception as it is.
    Any help would be greatly appretiated!!!
    Petr
    Code:
    String ql = "folderItems.contains(vfolderItem) && vfolderItem.parentFolder
    == parFolder";
              String params = "Folder parFolder";
              String variables = "FolderItem vfolderItem;";
              HashMap parValues = new HashMap();
              System.out.println("Folder PC" + (folder instanceof PersistenceCapable));
              parValues.put("parFolder", folder);
              if (createdStart != null) {
                   ql = ql + " && createdDate >= padStartDate";
                   params = params + ", java.util.Date padStartDate";
                   parValues.put("padStartDate", createdStart);
              if (createdStop != null) {
                   ql = ql + " && createdDate <= padStopDate";
                   params = params + ", java.util.Date padStopDate";
                   parValues.put("padStopDate", createdStop);
              if (receivedBy != null ) {
                   ql = ql + " && recipients.contains(vRecipient) &&
    vRecipient.recipientType == parRecipient";
                   params = params + ", CodeValue parRecipient";
                   variables = variables + "; Recipient vRecipient;";
                   parValues.put("parRecipient", receivedBy);
              if (sentBy != null) {
                   ql = ql + " && recipients.contains(vSender) && vSender.recipientType ==
    parSender";
                   params = params + ", CodeValue parSender";
                   variables = variables + "; Recipient vSender;";
                   parValues.put("parSender", sentBy);
              Collection col;
              Query q = ctx.getPersist().newQuery(ext, ql);
              q.declareVariables(variables);
              q.declareParameters(params);
              q.declareImports("import com.mallesons.servicenet.aa.folder.*;");
              q.setOrdering("createdDate ascending");
              q.compile();
              col = (Collection) q.executeWithMap(parValues);
              //col = (Collection) q.execute(folder);
    Stack:
    javax.jdo.JDOFatalUserException:
    com.mallesons.servicenet.aa.folder.Folder: java.util.HashMap
    NestedThrowables:
    java.io.NotSerializableException: com.mallesons.servicenet.aa.folder.Folder
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.serialize(AbstractDictionary.java:684)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.blobToSQL(AbstractDictionary.java:384)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.blobToPreparedParameter(AbstractDictionary.java:1067)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.SQLServerDictionary.blobToPreparedParameter(SQLServerDictionary.java:139)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.toPreparedParameter(AbstractDictionary.java:808)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLValue.applyParameter(SQLValue.java:129)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:239)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:222)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.prepareStatementInternal(SQLExecutionManagerImpl.java:824)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedQueryInternal(SQLExecutionManagerImpl.java:761)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQueryInternal(SQLExecutionManagerImpl.java:691)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecutionManagerImpl.java:372)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecutionManagerImpl.java:356)
         at
    com.solarmetric.kodo.impl.jdbc.ormapping.ClassMapping.selectPrimaryMappings(ClassMapping.java:1221)
         at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.executeQuery(JDBCStoreManager.java:707)
         at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.executeQuery(JDBCQuery.java:93)
         at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:792)
         at
    com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:668)
         at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:609)
         at
    com.mallesons.servicenet.ta.shared.BOQuery.executeWithMap(BOQuery.java:159)
         at
    com.mallesons.servicenet.aa.folder.SearchEmailItemService.searchDirect(SearchEmailItemService.java:105)
         at
    com.mallesons.servicenet.aa.folder.SearchEmailItemService.searchIn(SearchEmailItemService.java:45)
         at
    com.mallesons.servicenet.aa.folder.test.SearchItemServiceTest.testCascadeFaxNoTime(SearchItemServiceTest.java:217)
         at java.lang.reflect.Method.invoke(Native Method)
         at junit.framework.TestCase.runTest(TestCase.java:166)
         at junit.framework.TestCase.runBare(TestCase.java:140)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:131)
         at junit.framework.TestSuite.runTest(TestSuite.java:173)
         at junit.framework.TestSuite.run(TestSuite.java:168)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:329)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:218)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:151)
    NestedThrowablesStackTrace:
    java.io.NotSerializableException: com.mallesons.servicenet.aa.folder.Folder
         at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1205)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:383)
         at java.util.HashMap.writeObject(HashMap.java:825)
         at java.lang.reflect.Method.invoke(Native Method)
         at
    java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java:1925)
         at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1267)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:383)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.serialize(AbstractDictionary.java:680)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.blobToSQL(AbstractDictionary.java:384)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.blobToPreparedParameter(AbstractDictionary.java:1067)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.SQLServerDictionary.blobToPreparedParameter(SQLServerDictionary.java:139)
         at
    com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.toPreparedParameter(AbstractDictionary.java:808)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLValue.applyParameter(SQLValue.java:129)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:239)
         at
    com.solarmetric.kodo.impl.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:222)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.prepareStatementInternal(SQLExecutionManagerImpl.java:824)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedQueryInternal(SQLExecutionManagerImpl.java:761)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQueryInternal(SQLExecutionManagerImpl.java:691)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecutionManagerImpl.java:372)
         at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecutionManagerImpl.java:356)
         at
    com.solarmetric.kodo.impl.jdbc.ormapping.ClassMapping.selectPrimaryMappings(ClassMapping.java:1221)
         at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.executeQuery(JDBCStoreManager.java:707)
         at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCQuery.executeQuery(JDBCQuery.java:93)
         at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:792)
         at
    com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:668)
         at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:609)
         at
    com.mallesons.servicenet.ta.shared.BOQuery.executeWithMap(BOQuery.java:159)
         at
    com.mallesons.servicenet.aa.folder.SearchEmailItemService.searchDirect(SearchEmailItemService.java:105)
         at
    com.mallesons.servicenet.aa.folder.SearchEmailItemService.searchIn(SearchEmailItemService.java:45)
         at
    com.mallesons.servicenet.aa.folder.test.SearchItemServiceTest.testCascadeFaxNoTime(SearchItemServiceTest.java:217)
         at java.lang.reflect.Method.invoke(Native Method)
         at junit.framework.TestCase.runTest(TestCase.java:166)
         at junit.framework.TestCase.runBare(TestCase.java:140)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:131)
         at junit.framework.TestSuite.runTest(TestSuite.java:173)
         at junit.framework.TestSuite.run(TestSuite.java:168)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:329)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:218)
         at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:151)

Maybe you are looking for

  • Problem with internal speakers of MacBook Pro

    Hi, I wanted to know if anyone have experienced a problem with internal speakers of Mac Book Pro. In my MackBook the Internal speaker volume goes down automatically. I checked the System Preferences>Sound>Output , from there I check that it is in the

  • What's a good codec pack for Mac?

    My friend recommended K-Lite Codec Pack, but it only works on PC and I have a Mac. Is there a good codec pack for Mac?

  • Where can I get 11.4

    My new iPhone 6 will not work with iTunes 11.2.2 and my Macbook Pro will not update to 11.4. My wife has an older Macbook Pro and hers updated fine to 11.4. (Her iPhone is working with iTunes) How can I get 11.4?

  • Barcode Carriage Return Function not working in Forms 6i

    Dear All, I m using Oracle Forms 6i with OS Windows 2000 Professional When I receiving Data from Barcode slot reader RS232 interface, carriage Return funtion not working in the forms 6i for e.g Barcode is *12345$M* ('$M' for carriage return). Full AS

  • Firefox won't load any pages

    I've used Firefox on my laptop for a number of years without issue. I've routinely updated the program when notified of upgrades (current version is 3.6.11, can't exactly remember when I updated). I use my laptop both at home (cable broadband) and at