Query object java method issue

MyUsernameQuery['userNames'].indexOf('tomjones') will find
the tomjones
value in the query.
BUT:
MyUsernameQuery['id'].indexOf(99) won't find the numeric
index value, even
though it's in the record set.
BUT WAIT, THERE'S MORE:
If I manually build a query object with integer values and
try a similar
search for the numeric id value,it finds it!
What's up with that?
If it was a casting issue, why would it find it in the
manually built object
and NOT in the query object?
I tried casting the integer as a string but no luck.
I'm in over my head with these methods. Any help much
appreciated.
Cheers,
Lossed
__when the only tool you have is a hammer, everything looks
like a nail __

I should point out that the relative processing speeds are
dependant upon
the size of the recordset and position in that recordset of
the value being
searching for.
"Lossed" <[email protected]> wrote in message
news:eucai4$lhj$[email protected]..
> It was indeed the casting.
> I had to cast it as 'long'.
> There are other ways to find if the value exists:
> convert column array to list and listfindnocase(), Q of
Q, loop over
> query. I was trying to find the fastest. the underlying
java indexOf()
> method seems to leave the others in it's dust :).
>
> "cf_dev2" <[email protected]> wrote in
message
> news:euc51t$epr$[email protected]..
>>> I'm in over my head with these methods
>>
>> Doesn't answer your question, but is indexOf()
really the only way to get
>> the
>> job done? Just wondering if there is an easier way.
>>
>> The undocumented stuff is neat, but the java methods
tend to be stricter
>> about
>> object type and case than many of the standard CF
functions. Two things
>> may
>> appear the same but that doesn't mean they are the
same to java. It can
>> trip
>> you up ;)
>>
>> That could be the problem with your number column.
You didn't mention the
>> column type but some numeric data types don't map to
a java integer. For
>> example a biginteger column might map to a java
long. In which case
>> searching
>> for an integer wouldn't work. So it could still be a
casting
>> problem
>>
>>
>
>

Similar Messages

  • Performance issue with Business Objects Java JRC API in CRXI R2 version

    A report is developed using java JRC API in CR XI release 2. When I generate the report in the designer, it took less than 5 seconds to display the results in crystal report viewer inside the designer. But in the QA environment, when I generate the same report from the application, it takes almost 1 to 1.5 minutes to display the same results in PDF. I also noticed that if the dataset contains bigger volume of data, then the reports are taking even longer almost 15 to 20 minutes.
    While generating the report from the application, I noticed that most of time is taken during the execution of the com.crystaldecisions.report.web.viewer.ReportExportControl Object method as shown in following line of code
    exportControl.processHttpRequest(request, response, context, null)
    We thought the delay in exporting the report to PDF might be the layout of the report and data conversion to PDF for such a bigger volume of data.
    Then we investigated the issue and experimented quickly to generate the same report with same result set data from the application using XML, XSL and converted the output XSL-FO to PDF using Apache FOP (Formatting Objects Processor) implementation. The time taken to export the report to PDF is less than 6 seconds. By doing this experiment, it is proved that the issue is not with conversion of data to PDF but it is the performance problem with Business Objects Java JRC API in CR XI R2.
    In this regard, I searched for the above issue in the SAP community Network Forums -> Crystal Reports and Xcelsius -> Java Development -> Crystal Reports. But I did not find any answers or solutions for this kind of issue in the forums.
    Any suggestion, hint in this matter is very much appreciated.

    Ted, The setReportAppServer problem is resolved. Now I could able to generate the report with hardcoded values in the SQLs in just 6 seconds where as the same report was generated in CRXI R2 in 1 minute 15 seconds as mentioned in the earlier message.
    But, our exisiting application passes the parameter values to the SQLs embedded in the report. For some reason the parameters are not being passed to the report and the report displays only the labels without data.
    As per the crj 12 samples codes, the code is written as shown below.
    1. Created ReportClient Document
    2. SetReportAppServer
    3. Open the report
    4. Getting DatabaseController and switching the database connection at runtime
    5. Then setting the parameters as detailed below
    ParameteFields parameterFieldController = reportClientDoc.getDataDefController().getParameterFieldController();
    parameterFieldController.setCurrentValue("", "paramname",paramvalue);
    parameterFieldController.setCurrentValue("", "paramname",paramavalue);
    byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF); 
    6. Streaming the report to the browser
    Why the parematers are not being passed to the report?  Do I need to follow the order of setting these parameters?  Did I miss any line of code for setting Params using  crj 12?
    Any help in this regard would be greatly appreciated.

  • Support of Query newQuery(java.lang.Object compiled)

    The implementation of the Query newQuery(java.lang.Object compiled)
    method doesn't copy the Class of the candidate instances but it should
    ad the documentation says :
    "All of the settings of the other Query are copied to this Query, except
    for the candidate Collection or Extent."
    Thanks.

    You can't query on a blob column.

  • Remote Object - not able to get the returned value from java method

         Hi ,
    I am developing one sample flex aplication that connects to the java code and displays the returned value from the
    java method in flex client. Here I am able to invoke the java method but not able to collect the returned value.
    lastResult is giving null .  I am able to see the sysout messages in server console.
    I am using flex 3.2 and blazeds server  and java 1.5
    Here is the code what I have written.
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication  xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" initialize="initApp()">
     <mx:Script><![CDATA[
    import mx.controls.Alert; 
    import mx.binding.utils.ChangeWatcher; 
    import mx.rpc.events.ResultEvent; 
    import mx.messaging.*; 
    import mx.messaging.channels.* 
    public function initApp():void { 
         var cs:ChannelSet = new ChannelSet(); 
         var customChannel:Channel = new AMFChannel("my-amf", "http://localhost:8400/blazeds/messagebroker/amf");     cs.addChannel(customChannel);
         remoteObj.channelSet = cs;
    public function writeToConsole():void {      remoteObj.writeToConsole(
    "hello from Flash client");
          var returnedVal:String = remoteObj.setName().lastResult;     Alert.show(returnedVal);
    //[Bindable] 
    // private var returnedVal:String; 
    ]]>
    </mx:Script>
    <mx:RemoteObject id="remoteObj" destination="sro" /> 
    <mx:Form width="437" height="281">
     <mx:FormItem>  
    </mx:FormItem>  
    <mx:Button label="Write To Server Console" click="writeToConsole()"/>
     </mx:Form>
     </mx:WindowedApplication>
    Java code
    public  
         public SimpleRemoteObject(){  
              super();     }
      class SimpleRemoteObject { 
         public void writeToConsole(String msg) {          System.out.println("SimpleRemoteObject.write: " + msg);     }
         public String setName(){          System.
    out.println("Name changed in Java"); 
              return "Name changed in Java";
    And I have configured destination in  remote-config.xml
    <destination id="sro">
       <properties>    
        <source>SimpleRemoteObject</source>
        <scope>application</scope>
       </properties>
      </destination>
    Please help me .

    You are not able to get the returned value because if you see the Remote object help you will realise you have to use result="resultfn()" and fault = "faultfn()"
    In this you define what you wish to do.
    More importantly in the remote object you need to define which method you wish to call using the method class like this
    <mx:RemoteObject id="remoteObj" destination="sro" result="r1" fault="f1"  >
         <Method name="javaMethodName" result="r2" fault="f2"/>
    <mx:RemoteObject>
    r2 is the function where you get the result back from java and can use it to send the alert.

  • Problem with return a ColdFusion query object from a Java class

    Hi!
    I need to return a ColdFusion query object from a Java class
    using a JDBC result set ( java.sql.ResultSet);
    I have tried to pass my JDBC result set in to the constructor
    of the coldfusion.sql.QueryTable class with this code:
    ColdFusion code
    <cfset pra = createObject("java","QueryUtil").init()>
    <cfset newQuery = CreateObject("java",
    "coldfusion.sql.QueryTable")>
    <cfset newQuery.init( pra.getColdFusionQuery () ) >
    My java class execute a query to db and return QueryTable
    Java code (QueryUtil.java)
    import coldfusion.sql.QueryTable; // (CFusion.jar for class
    QueryTable)
    import com.allaire.cfx //(cfx.jar for class Query used from
    QueryTable)
    public class QueryUtil
    public static coldfusion.sql.QueryTable
    getColdFusionQuery(java.sql.ResultSet rs)
    return new coldfusion.sql.QueryTable(rs);
    but when i run cfm page and coldfusion server tries to
    execute : "<cfset pra =
    createObject("java","QueryUtil").init()>" this error appears:
    Object Instantiation Exception.
    An exception occurred when instantiating a java object. The
    cause of this exception was that: coldfusion/sql/QueryTable.
    If i try to execute QueryUtil.java with Eclipse all it works.
    Also I have tried to return java.sql.ResultSet directly to
    coldfusion.sql.QueryTable.init () with failure.
    Do you know some other solution?

    ok
    i print all my code
    pratica.java execute a query to db and return a querytable
    java class
    import java.util.*;
    import java.sql.*;
    import coldfusion.sql.*;
    public class Pratica {
    private HashMap my;
    private String URI,LOGIN,PWD,DRIVER;
    private Connection conn=null;
    //funzione init
    //riceve due strutture converite in hashmap
    // globals
    // dbprop
    public Pratica(HashMap globals,HashMap dbprop) {
    my = new HashMap();
    my.put("GLOBALS",globals);
    my.put("DBPROP",dbprop);
    URI = "jdbc:sqlserver://it-bra-s0016;databaseName=nmobl";
    LOGIN = "usr_dev";
    PWD = "developer";
    DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    try{
    // Carico il driver JDBC per la connessione con il database
    MySQL
    Class.forName(DRIVER);
    /* Connessione alla base di dati */
    conn=DriverManager.getConnection(URI,LOGIN,PWD);
    if(conn!=null) System.out.println("Connection Successful!");
    } catch (ClassNotFoundException e) {
    // Could not find the database driver
    System.out.print("\ndriver non trovato "+e.getMessage());
    System.out.flush();
    catch (SQLException e) {
    // Could not connect to the database
    System.out.print("\nConnessione fallita "+e.getMessage());
    System.out.flush();
    //funzione search
    //riceve un hash map con i filtri di ricerca
    public QueryTable search(/*HashMap arg*/) {
    ResultSet rs=null;
    Statement stmt=null;
    QueryTable ret=null;
    String query="SELECT * FROM TAN100pratiche";
    try{
    stmt = conn.createStatement();// Creo lo Statement per
    l'esecuzione della query
    rs=stmt.executeQuery(query);
    // while (rs.next()) {
    // System.out.println(rs.getString("descrizione"));
    catch (Exception e) {
    e.printStackTrace();
    try {
    ret = Pratica.RsToQueryTable(rs);
    } catch (SQLException e) {
    e.printStackTrace();
    this.close();
    return(ret);
    // ret=this.RsToQuery(rs);
    // this.close(); //chiude le connessioni,recordset e
    statament
    //retstruct CF vede HashMap come struct
    //METODO DI TEST
    public HashMap retstruct(){
    return(my);
    //conversione resultset to querytable
    private static QueryTable RsToQueryTable(ResultSet rs)
    throws SQLException{
    return new QueryTable(rs);
    //chiura resultset statament e connessione
    private void close(){
    try{
    conn.close();
    conn=null;
    catch (Exception e) {
    e.printStackTrace();
    coldfusion code
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
    Transitional//EN">
    <html>
    <head>
    <title>Test JDBC CFML Using CFScript</title>
    </head>
    <body>
    <cftry>
    <cfset glb_map =
    createObject("java","java.util.HashMap")>
    <cfset dbprop_map =
    createObject("java","java.util.HashMap")>
    <cfset glb_map.init(glb)> <!---are passed from
    another page--->
    <cfset dbprop_map.init(glb["DBPROP"])>
    <cfset pra =
    createObject("java","Pratica").init(glb_map,dbprop_map)>
    <cfset ourQuery
    =createObject("java","coldfusion.sql.QueryTable").init(pra.search())>
    <cfcatch>
    <h2>Error - info below</h2>
    <cfdump var="#cfcatch#"><cfabort>
    </cfcatch>
    </cftry>
    <h2>Success - statement dumped below</h2>
    <cfdump var="#ourQuery#">
    </body>
    </html>
    error at line <cfset pra =
    createObject("java","Pratica").init(glb_map,dbprop_map)>
    An exception occurred when instantiating a java object. The
    cause of this exception was that: coldfusion/sql/QueryTable.
    -----------------------------------------------------------------------

  • How to re-issue an SQL query in java code in deadlock situation ?

    Hi all..
    I have a java application (in Struts) which is running on JBoss 4.0.1 server. The database is MySql 6.0. It is an
    application made to be used among multiusers. The background operating system is Windows Vista.
    Now a days i am facing a peculiar problem due to which the further things go wrong. I am getting following error :
    com.mysql.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
    I searched over forums and i got response as restart the transaction in deadlock.
    In my java code it is a delete query where i get such exception when multiple users are accessing the application. What i tried for time being is as follows :
    Statement stmt = null;
    String temp = null;
    Connection conn = null;
    String sUserID =(String) session.getAttribute("username")
    try
    conn = DBConnection.getJndiConnection();
    stmt = conn.createStatement();
    temp = "Delete FROM temptable where Login ='"+sUserID+"'";
    System.out.println("QUERY:"+temp);
    int rowCount = stmt.executeUpdate(temp);
    System.out.println("Rows affected in try ="+rowCount+" for user :"+sUserID);
    // in catch i re-issue the delete query in deadlock..
    catch (com.mysql.jdbc.exceptions.MySQLTransactionRollbackException ne)
    System.out.println("Error ....Deadlock occured for user: "+sUserID);
    ne.printStackTrace();
    try
    int rowCount = s.executeUpdate(temp);
    System.out.println("Rows affected in catch ="+rowCount+" for user :"+sUserID);
    catch (Exception e)
    System.out.println("Exception again after restarting transaction..with user :"+sUserID);
    e.printStackTrace();
    (all necessary imports are present in code)
    Here i am properly establishing the database connection with the help of other class DBConnection. As most of the forum insisted to re-issue the transaction, i have tried upto one level with above code. But still the problem is just partially solved.
    How can i write my code so that every time if there is MySQLTransactionRollbackException , then the delete query should be re-issued again and again untill the transaction is complete.
    Can i use GOTO statement ? or is it bad programming practice?
    What are the other possible ways ??
    Can someone please help in this regard ??
    Thanks in advance..
    Regards
    Prasad

    Hi all
    i am new for these kind of databae transaction operation i am getting following error
    /resetattendancedata.dqlMessage: Deadlock found when trying to get lock; Try restarting transaction, message from server: "Lock wait timeout exceeded; try restarting transaction" Cause: null Error Message: Deadlock found when trying to get lock; Try restarting transaction, message from server: "Lock wait timeout exceeded; try restarting transaction" Cause: null Error code: 1205 Error state: 41000 java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction, message from server: "Lock wait timeout exceeded; try restarting transaction"
    Here is my code i have written
    if(movements.equalsIgnoreCase("ON"))
    System.out.println("Movement");
    if(submovements.equalsIgnoreCase("statusonly"))
    query="";
    query="UPDATE TRNMOVEMENT SET PROCESSED='N',STATUSPUT='N',ATTDATE=NULL,TIMEDIFF='' "
    +"WHERE ATTDATE BETWEEN '"datefrom1"' AND '"dateto"' AND EMPID IN "
    +"(SELECT SYSEMPID "
    +"FROM (((MSTPERSONALDETAILS PD LEFT JOIN MSTCATEGORY CAT ON PD.CATEGCODE=CAT.SYSCATEGCODE)"
    +"LEFT JOIN MSTUNITDETAILS U ON PD.UNITCODE=U.SYSUNITCODE) "
    +"LEFT JOIN MSTDESIGNATION DES ON PD.DESIGCODE=DES.SYSDESIGCODE) "
    +"LEFT JOIN MSTDEPARTMENT DEP ON PD.DEPTCODE=DEP.SYSDEPTCODE "strFltrString" ) ";
    leaveStmt.executeUpdate(query);
    leaveStmt.executeUpdate("commit");
    else if(submovements.equalsIgnoreCase("flagstatus"))
    query="";
    query="UPDATE TRNMOVEMENT SET PROCESSED='N',STATUSPUT='N',ATTDATE=NULL,FLAG='',TIMEDIFF='',BREAK='N'WHERE ATTDATE BETWEEN '"datefrom1"' AND '"dateto"' AND EMPID IN (SELECT SYSEMPID FROM(((MSTPERSONALDETAILS PD LEFT JOIN MSTCATEGORY CAT ON PD.CATEGCODE=CAT.SYSCATEGCODE) LEFT JOIN MSTUNITDETAILS U ON PD.UNITCODE=U.SYSUNITCODE) LEFT JOIN MSTDESIGNATION DES ON PD.DESIGCODE=DES.SYSDESIGCODE) LEFT JOIN MSTDEPARTMENT DEP ON PD.DEPTCODE=DEP.SYSDEPTCODE WHERE EMPID IS NOT NULL "strFltrString" ) ";
    leaveStmt.executeUpdate(query);
    synchronized(leaveStmt)
    //leaveStmt1.executeUpdate("set TRANSACTION ISOLATION LEVEL REPEATABLE READ"); // setting transaction level using SQL
    // leaveStmt1.executeUpdate("start transaction"); // Starting a transaction using SQL     
    query1="DELETE FROM TRNDAILYATTENDANCE WHERE ATTDATE BETWEEN '"datefrom1"' AND '"dateto"' AND EMPID IN (SELECT SYSEMPID FROM (((MSTPERSONALDETAILS PD "
    +"LEFT JOIN MSTCATEGORY CAT ON PD.CATEGCODE=CAT.SYSCATEGCODE) LEFT JOIN MSTUNITDETAILS U ON PD.UNITCODE=U.SYSUNITCODE) LEFT JOIN MSTDESIGNATION DES ON PD.DESIGCODE = DES.SYSDESIGCODE )LEFT JOIN MSTDEPARTMENT DEP ON PD.DEPTCODE=DEP.SYSDEPTCODE WHERE EMPID IS NOT NULL "strFltrString" )";
    //leaveStmt.addBatch(query1);
    leaveStmt.executeUpdate(query1);
    synchronized(leaveStmt)
    query2="UPDATE TRNLEAVEAPPLICATION SET TAKENTOATT='N' WHERE '"datefrom1"' BETWEEN FROMDATE AND "
    +"TODATE AND '"dateto"' BETWEEN FROMDATE AND TODATE AND EMPID IN (SELECT SYSEMPID FROM (((MSTPERSONALDETAILS PD LEFT JOIN MSTCATEGORY CAT ON "
    +"PD.CATEGCODE=CAT.SYSCATEGCODE) LEFT JOIN MSTUNITDETAILS U ON PD.UNITCODE=U.SYSUNITCODE) LEFT JOIN "
    +"MSTDESIGNATION DES ON PD.DESIGCODE=DES.SYSDESIGCODE) LEFT JOIN MSTDEPARTMENT DEP ON PD.DEPTCODE=DEP.SYSDEPTCODE WHERE EMPID IS NOT NULL "+strFltrString +") ";
    //leaveStmt.addBatch(query2);
    //leaveStmt.executeBatch();
    leaveStmt.executeUpdate(query2);
    //} // end of for loop
    else
    leaveStmt.executeUpdate("commit");
    Please Solve my problem for this error thanks in advance........

  • How do I deal with a Java method which returns a class object?

    Hi, I am using JNI to talk to some Java code from c++;
    I have a java method in class B that is defined as
    class B{
    A[] As;
    A getA(int i){
    return As(i);
    where A is one of my classes.
    I would like to know the code to deal with a returned object of type A and then how to access the variables in A from c++.
    I have defined my method pointer as :
    env->GetMethodID(B, "getA", "(I)A;");and have the jclass object of type A.
    Would I do something like jclass A_CLASS = env->FindClass("A");
    jobject A_OBJECT = (A_CLASS)env->CallObjectMethod(B,getA, i) ; If so, how do I then access the fields in A_OBJECT? Please let me know, thanks.

    ilganeli wrote:
    Thanks but this doesn't really help. I know how this is done in Java (see below).Presumably you also understand how that code will fail. At least based on what you have posted here.
    I do not understand the syntax to do the equivalent thing in JNI, specifically, how to cast the returned object from the CallObjectMethod function to be of the appropriate type, namely A, and then how to access those fields. You don't cast it. Didn't do so in your java code either.
    But you define how you are going to attempt to access any object in JNI. If you mess up it fails.

  • Issue with POF serialization - Failure to deserialize an Invocable object: java.io.StreamCorruptedException

    Am running into following exception even after following all guidelines to implement POF. The main objective is to perform Distributed Bulk cache loading.
    Oracle Coherence GE 3.7.1.10 <Error> (thread=Invocation:InvocationService, member=1): Failure to deserialize an Invocable object: java.io.StreamCorruptedException: unknown user type: 1001
    java.io.StreamCorruptedException: unknown user type: 1001
      at com.tangosol.io.pof.PofBufferReader.readAsObject(PofBufferReader.java:3312)
      at com.tangosol.io.pof.PofBufferReader.readObject(PofBufferReader.java:2604)
      at com.tangosol.io.pof.ConfigurablePofContext.deserialize(ConfigurablePofContext.java:371)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.Service.readObject(Service.CDB:1)
      at com.tangosol.coherence.component.net.Message.readObject(Message.CDB:1)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.InvocationService$InvocationRequest.read(InvocationService.CDB:8)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.deserializeMessage(Grid.CDB:19)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:31)
      at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
      at java.lang.Thread.run(Thread.java:662)
    Following is the pof-config.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <pof-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns="http://xmlns.oracle.com/coherence/coherence-pof-config"
                xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-pof-config/1.1/coherence-pof-config.xsd">
      <user-type-list>
        <include>coherence-pof-config.xml</include>
        <user-type>
          <type-id>1001</type-id>
          <class-name>com.westgroup.coherence.bermuda.loader.DistributedLoaderAgent</class-name>
          <serializer>
            <class-name>com.tangosol.io.pof.PofAnnotationSerializer</class-name>     
            <init-params>
              <init-param>
                <param-type>int</param-type>
                <param-value>{type-id}</param-value>
              </init-param>
              <init-param>
                <param-type>java.lang.Class</param-type>
                <param-value>{class}</param-value>
              </init-param>
              <init-param>
                <param-type>boolean</param-type>
                <param-value>true</param-value>
              </init-param>
            </init-params>
          </serializer>
        </user-type>
         <user-type>
          <type-id>1002</type-id>
          <class-name>com.westgroup.coherence.bermuda.profile.lpa.LPACacheProfile</class-name>
          <serializer>
            <class-name>com.tangosol.io.pof.PofAnnotationSerializer</class-name>     
            <init-params>
              <init-param>
                <param-type>int</param-type>
                <param-value>{type-id}</param-value>
              </init-param>
              <init-param>
                <param-type>java.lang.Class</param-type>
                <param-value>{class}</param-value>
              </init-param>
              <init-param>
                <param-type>boolean</param-type>
                <param-value>true</param-value>
              </init-param>
            </init-params>
          </serializer>
        </user-type>
         <user-type>
          <type-id>1003</type-id>
          <class-name>com.westgroup.coherence.bermuda.profile.lpa.Address</class-name>
          <serializer>
            <class-name>com.tangosol.io.pof.PofAnnotationSerializer</class-name>     
            <init-params>
              <init-param>
                <param-type>int</param-type>
                <param-value>{type-id}</param-value>
              </init-param>
              <init-param>
                <param-type>java.lang.Class</param-type>
                <param-value>{class}</param-value>
              </init-param>
              <init-param>
                <param-type>boolean</param-type>
                <param-value>true</param-value>
              </init-param>
            </init-params>
          </serializer>
        </user-type>
         <user-type>
          <type-id>1004</type-id>
          <class-name>com.westgroup.coherence.bermuda.profile.lpa.Discipline</class-name>
          <serializer>
            <class-name>com.tangosol.io.pof.PofAnnotationSerializer</class-name>     
            <init-params>
              <init-param>
                <param-type>int</param-type>
                <param-value>{type-id}</param-value>
              </init-param>
              <init-param>
                <param-type>java.lang.Class</param-type>
                <param-value>{class}</param-value>
              </init-param>
              <init-param>
                <param-type>boolean</param-type>
                <param-value>true</param-value>
              </init-param>
            </init-params>
          </serializer>
        </user-type>
         <user-type>
          <type-id>1005</type-id>
          <class-name>com.westgroup.coherence.bermuda.profile.lpa.Employment</class-name>
          <serializer>
            <class-name>com.tangosol.io.pof.PofAnnotationSerializer</class-name>     
            <init-params>
              <init-param>
                <param-type>int</param-type>
                <param-value>{type-id}</param-value>
              </init-param>
              <init-param>
                <param-type>java.lang.Class</param-type>
                <param-value>{class}</param-value>
              </init-param>
              <init-param>
                <param-type>boolean</param-type>
                <param-value>true</param-value>
              </init-param>
            </init-params>
          </serializer>
        </user-type>
      </user-type-list>
      <allow-interfaces>true</allow-interfaces>
      <allow-subclasses>true</allow-subclasses>
    </pof-config>
    cache-config.xml
    <cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"
      xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config http://xmlns.oracle.com/coherence/coherence-cache-config/1.1/coherence-cache-config.xsd">
       <defaults>
        <serializer>pof</serializer>
        </defaults>
      <caching-scheme-mapping>
      <cache-mapping>
      <cache-name>DistributedLPACache</cache-name>
      <scheme-name>LPANewCache</scheme-name>
      <init-params>
      <init-param>
      <param-name>back-size-limit</param-name>
      <param-value>250MB</param-value>
      </init-param>
      </init-params>
      </cache-mapping>
      </caching-scheme-mapping>
      <caching-schemes>
      <!-- Distributed caching scheme. -->
      <distributed-scheme>
      <scheme-name>LPANewCache</scheme-name>
      <service-name>HBaseLPACache</service-name>
      <serializer>
      <instance>
                 <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
                 <init-params>
                   <init-param>
                     <param-type>java.lang.String</param-type>
                     <param-value>pof-config.xml</param-value>
                   </init-param>
                 </init-params>
            </instance>
      </serializer>
      <backing-map-scheme>
      <read-write-backing-map-scheme>
      <internal-cache-scheme>
      <class-scheme>
      <class-name>com.tangosol.util.ObservableHashMap</class-name>
      </class-scheme>
      </internal-cache-scheme>
      <cachestore-scheme>
      <class-scheme>
      <class-name>com.westgroup.coherence.bermuda.profile.lpa.LPACacheProfile</class-name>
      </class-scheme>
      </cachestore-scheme>
      <read-only>false</read-only>
      <write-delay-seconds>0</write-delay-seconds>
      </read-write-backing-map-scheme>
      </backing-map-scheme>
      <autostart>true</autostart>
      </distributed-scheme>
      <invocation-scheme>
           <scheme-name>InvocationService</scheme-name>
           <service-name>InvocationService</service-name>
           <thread-count>5</thread-count>
           <autostart>true</autostart>
        </invocation-scheme>
      </caching-schemes>
    </cache-config>
    DistributedLoaderAgent (user type 1001)
    import java.io.IOException;
    import java.io.Serializable;
    import java.lang.annotation.Annotation;
    import org.apache.log4j.Logger;
    import com.tangosol.io.pof.PofReader;
    import com.tangosol.io.pof.PofWriter;
    import com.tangosol.io.pof.PortableObject;
    import com.tangosol.io.pof.annotation.Portable;
    import com.tangosol.io.pof.annotation.PortableProperty;
    import com.tangosol.net.AbstractInvocable;
    import com.tangosol.net.InvocationService;
    @Portable
    public class DistributedLoaderAgent extends AbstractInvocable implements PortableObject{
      private static final long serialVersionUID = 10L;
      private static Logger m_logger = Logger.getLogger(DistributedLoaderAgent.class);
      @PortableProperty(0)
      public String partDumpFileName = null;
      public String getPartDumpFileName() {
      return partDumpFileName;
      public void setPartDumpFileName(String partDumpFileName) {
      this.partDumpFileName = partDumpFileName;
      public DistributedLoaderAgent(){
      super();
      m_logger.debug("Configuring this loader ");
      public DistributedLoaderAgent(String partDumpFile){
      super();
      m_logger.debug("Configuring this loader to load dump file "+ partDumpFile);
      partDumpFileName = partDumpFile;
      @Override
      public void init(InvocationService service) {
      // TODO Auto-generated method stub
      super.init(service);
      @Override
      public void run() {
      // TODO Auto-generated method stub
      try{
      m_logger.debug("Invoked DistributedLoaderAgent");
      MetadataTranslatorService service = new MetadataTranslatorService(false, "LPA");
      m_logger.debug("Invoking service.loadLPACache");
      service.loadLPACache(partDumpFileName);
      }catch(Exception e){
      m_logger.debug("Exception in DistributedLoaderAgent " + e.getMessage());
      @Override
      public void readExternal(PofReader arg0) throws IOException {
      // TODO Auto-generated method stub
      setPartDumpFileName(arg0.readString(0));
      @Override
      public void writeExternal(PofWriter arg0) throws IOException {
      // TODO Auto-generated method stub
      arg0.writeString(0, getPartDumpFileName());
    Please assist.

    OK I have two suggestions.
    1. Always create and flush the ObjectOutputStream before creating the ObjectInputStream.
    2. Always close the output before you close the input. Actually once you close the output stream both the input stream and the socket are closed anyway so you can economize on this code. In the above you have out..writeObject() followed by input.close() followed by out.close(). Change this to out.writeObject() followed by out.close(). It may be that something needed flushing and the input.close() prevented the flush from happening.

  • Flex call Java method/objects?

    Hi guys,
    I have a Flex application embedded in a Java Swing application.
    Can I call Java methods or objects from the Flex application?
    How to?
    Thanks in advance!
    Sha Jiang

    You register your java class as a bean and put an actionlistener or an action method on the button binding it to the bean.
    Did you check out the tutorial section [http://www.oracle.com/technology/products/jdev/11/cuecards/index.html|http://www.oracle.com/technology/products/jdev/11/cuecards/index.html] ?
    There is other useful stuff on the jdev home page.
    One simple way is to select the button in the jspx file, open the property inspector, click the small triangle on the left to actionlistener. In the dialog appearing you hit new by managed bean and give it all information and new by the method name and enter a method name to call. The new method will be created in the bean class for you. From this method you call your custom method.
    Timo

  • How to have the JTA transaction in ServiceEndpoint interface java method

    Hi,
    I have query how to have the JTA transaction in SEI(Service endpoint interface) generated by WSDL.
    I have a MDMListener (using MDM API) which looks for a recordchange in MDM repository which needs to be send to PI7.1 via soap request.
    1) I had imported the WSDL from ESR(PI) and generated outside-in proxy.
    2) Created ejb3.0 stateless session bean using NWDS
    3) Created web service client application by generating the WSDL again (by Generate client)
    4)Added a method callPI()with Service and i set the context with endpointaddress property as the soap location of the sender agreement configured in PI7.1.
    The damean thread listener(EventDispatcher) looks for MDM record change and it calls the method callPI() from ejbsession bean by lookup to transfer the record to PI7.1 system via webservices(web method). I hit the below error.
    Exception com.sap.engine.services.ts.exceptions.BaseIllegalStateException: Status of ( SAP J2EE Engine JTA Transaction : 06223ffffffa20048fffffffe ) should be active, but it is STATUS_COMMITTED = 3.
    at com.sap.engine.services.ts.jta.impl.TransactionImpl.registerSynchronizationWithoutStatusChecks(TransactionImpl.java:672)
    at com.sap.engine.services.ts.jta.impl.TransactionImpl.registerSynchronization(TransactionImpl.java:641)
    at com.sap.engine.services.ts.transaction.TxLevelSynchronizations.addSynchronization(TxLevelSynchronizations.java:118)
    at com.sap.engine.services.ts.transaction.TxManagerImpl.registerSynchronization(TxManagerImpl.java:829)
    at com.sap.transaction.TxManager.registerSynchronization(TxManager.java:303)
    at com.sap.engine.messaging.runtime.j2ee.sapengine.SAPTransactionManager.registerSynchronization(SAPTransactionManager.java:126)
    at com.sap.engine.messaging.impl.util.tx.TxController.<init>(TxController.java:83)
    //Method in the ejb stateless session bean
    @WebServiceRef (name="DistributeMasterDataService") DistributeMasterDataService service;
    @RelMessagingNW05DTOperation(enableWSRM=true)
    public void callPi(DistributeMasterDataRequestType req) {
    port.distributeMasterDataOutA(req);// the distributeMasterDataOutA is the method available in SEI..Here is the issue on JTA
    For the first time the message(req object)transmits to the PI successfully,but for the second call i hit this JTA Transaction :status should be active, but it is STATUS_COMMITTED = 3.
    I tried chanding the transactionmanagement from container to bean.
    @TransactionManagement(value=TransactionManagementType.BEAN)
    @TransactionAttribute(value=TransactionAttributeType.REQUIRES_NEW)
    I wanted to know how can i have the JTA transaction status in SEI(service enpoint interface)java method distributeMasterDataOutA.Since it is an interface i dont know what annotation can be used.
    If its possible i can try this UserTransaction,
    http://help.sap.com/saphelp_nw04/helpdata/de/f6/7a8df922db4ab79342b46c48dac7d0/content.htm
    ut.begin() & ut.commit(),so that everytime this method is called it will treat as a new transaction..
    Let me know if you need more details??,Any idea provided would be great.
    Thanks
    Sabarinathan

    Hello everybody,
    The issue resolved,we need to have the bean management transaction type and not the container.
    and the transactionattribute value as Requires New
    rgds
    Sabarinathan
    Edited by: Sabarinathan Selvaraj on May 12, 2009 2:17 PM

  • Query object

    Hi Experts,
    I am really stuck on this issue now.
    I am trying to get an attribute of BuilMarketing object(Industry attribute) on my lead screen corresponding to the prospect selected.
    I am using query object for this.I am writing this code in the event handler EH_ONSEL_PROSPECT(I have redefined it).I am writing such code for the first time and i m really stuck.I am getting syntax error:
    Method "GET_PROPERTY_AS_VALUE" is unknown or PROTECTED or PRIVATE.     
    Is my approach correct.
    Please help me!!!     
    method EH_ONSEL_PROSPECT.
    CALL METHOD SUPER->EH_ONSEL_PROSPECT
      EXPORTING
        HTMLB_EVENT    = HTMLB_EVENT
       HTMLB_EVENT_EX = HTMLB_EVENT_EX
    DATA : industry(4) type c,
           query_service      TYPE REF TO  cl_crm_bol_dquery_service,
           query_result        TYPE REF TO if_bol_entity_col,
           lr_builheader       TYPE REF TO cl_crm_bol_entity,
           lv_builbc           TYPE REF TO if_bol_entity_col,
           lr_partnerno        TYPE string.
    query_service = cl_crm_bol_dquery_service=>get_instance( 'BuilHeaderAdvancedSearch' ).
      IF query_service IS BOUND.
        CALL METHOD query_service->add_selection_param
          EXPORTING
            iv_attr_name = 'PARTNER'
            iv_sign      = 'I'
            iv_option    = 'EQ'
            iv_low       = lr_partnerno.
        query_result = query_service->get_query_result( ).
        lr_builheader = query_result->get_first( ).
        endif.
    CHECK lr_builheader IS BOUND.
        lv_builbc = lr_builheader->get_related_entities( iv_relation_name = 'BuilMarketingRel').
    lv_builbc->get_property_as_value( EXPORTING iv_attr_name = 'INDUSTRY'
                             IMPORTING ev_result    = industry ).
    call method lv_builbc->set_property (iv_attr_name = 'INDUSTRY' iv_value = ev_result ).
    endmethod.

    the query object implements a lot of interfaces, including "DataSource":
    So best way is retrieve the Query object is by using the MDRoot: this one has a lookup method, which can be used to "load" the query object. afterwards you can assign it to a crosstab,graph,etc...
    regards,
    thomas

  • How to call a java method in a Stored procedure

    Hi.,
    I was trying to call a method in a stored procedure
    This was my procedure
    CREATE OR REPLACE PROCEDURE proc_copy_file(sr_file VARCHAR2,dt_file VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'FileCopy.copyfile(String,String)'; // calling a java method
    /   this was my java method
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "FileCopy" as
    import java.io.File;
      import java.io.IOException;
      import java.io.FileReader;
      import java.io.FileWriter;
      import javax.imageio.stream.FileImageInputStream;
      import javax.imageio.stream.FileImageOutputStream;
      import java.security.AccessControlException;
      public class FileCopy {
          // Define variable(s).
              private static int c;
              private static File file1,file2;
              private static FileReader inTextFile;
              private static FileWriter outTextFile;
              private static FileImageInputStream inImageFile;
              private static FileImageOutputStream outImageFile;
              // Define copyText() method.
              public static void copyfile(String fromFile,String toFile) throws AccessControlException
                // Create files from canonical file names.
                file1 = new File(fromFile);
                file2 = new File(toFile);
                // Copy file(s).
                try
                  // Define and initialize FileReader(s).
                  inTextFile  = new FileReader(file1);
                  outTextFile = new FileWriter(file2);
                  // Read character-by-character.
                  while ((c = inTextFile.read()) != -1) {
                    outTextFile.write(c); }
                  // Close Stream(s).
                  inTextFile.close();
                  outTextFile.close(); }
                catch (IOException e) {
                  System.out.println ("-------"); }
             // return 1;
          public static void main(String[] args){
                          switch(args.length){
                                  case 0: System.out.println("File has not mentioned.");
                                                  System.exit(0);
                                  case 1: System.out.println("Destination file has not mentioned.");
                                                  System.exit(0);
                                  case 2: copyfile(args[0],args[1]);
                                                  System.exit(0);
                                  default : System.out.println("Multiple files are not allow.");
                                                    System.exit(0);
    };while i am executing this method i m getting error as
    ORA-29531: NO METHOD COPYFILE IN CLASS FILECOPY
    ORA-06512: AT "RMVER721.PROC_COPY_FILE", LINE 1could anyone help me

    Looks like it is a matter of not quite the same namespace for String object.
    I can get it to work by the java source containing:
              public static void copyfile(java.lang.String fromFile,java.lang.String toFile) throws AccessControlExceptionAnd the PL/SQL source:
    NAME 'FileCopy.copyfile(java.lang.String,java.lang.String)'; // calling a java methodSeems like when you just use "String", then the namespace resolving in the java source is not the same as the namespace resolving in the PL/SQL?
    Addendum:
    You do not need to put java.lang.String in the java source, String will do (java.lang is by default "imported"?)
    But in the PL/SQL source java.lang namespace prefix is needed - java.lang is not "imported" here.
    Edited by: Kim Berg Hansen on Nov 23, 2011 1:07 PM

  • How to call a Java method in a C consoleapplication?

    I have to call a void method of a javaclass using a c consoleapplication. No argument are passed to it.
    I can't make an object of that class..
    This is my implementation in c (using JNI):
    void update(void)
         classn = "<name>";
         cls = (*env) ->FindClass(env, classn );
         if (cls == 0)
    printf(" Can't find class %s\n", classn );
         mid =
    (*env)->GetMethodID(env, cls, "<methodname>", "()V");
         (*env)->CallVoidMethod(obj, env ,m id);
    This goes wrong...
    The problem is that I have no jobject (obj) of the class, because I don't want one...I don't need one. How can I call that void method without an object and only using the classname..??

    You have to make the java method a static method, and use CallStaticVoidMethod.
    "static" means that the method belongs to the class, and not an object of that class.

  • Could not get schema Object:java.sql.SQLSyntaxErrorException ora-904

    All of a sudden I get
    Could not get schema Object:java.sql.SQLSyntaxErrorException: ORA-00904: "SYS"."O"."NAME": ongeldige ID
    when doing anything in the tables tree in the connections pane
    The only thing I set recently is pga_aggregate_target
    Environment
    Oracle 11.2.0.1
    OS Windows Vista Ultimate sp2
    Sql developer 2.1.1.64.39 with its own JDK
    As the download links on OTN are broken I can not upgrade, and I'd rather not work in command line sqlplus.
    Help!!!
    Sybrand Bakker
    Senior Oracle DBA

    My copy of sqldeveloper isn't located in that directory. Would that matter?
    In the mean time I have disabled filtering the tables node. Opening the tables node doesn't result in exceptions anymore.
    Now, when I click on any table in that node I get 4 identical ora-904 error messages for sys.o.name for any table.
    Apparently it is querying either the all_objects view and it thinks it is querying sys.obj$.
    I didn't yet enable sql_trace for the session, I'm more or less giving up on sqldeveloper. I can not use the space bar in any datagrid, sqldeveloper has always been extreemly unresponsive when navigating the schema browser (as opposed to Toad), etc, etc. Too bad I bought Sue Harpers book, but I think I will be de-installing sqldeveloper soon.
    Sybrand Bakker
    Senior Oracle DBA

  • Creation of Data Control for custom java method  which will return records

    Hi Guys,
    I have a requirement of creating a a custom java method in App module which will return a record set taking an id as input.In case of single return type it works fine but in case of returning record set it is not working.In my case i have to combine two tables and return it as a single entity as a view in Data Control.
    Warm Regards,
    Srinivas.

    Why don't you just create a custom view object? There's even an example or 2 in the docs:
    http://docs.oracle.com/cd/E16162_01/web.1112/e16182/intro_tour.htm#CHDGDIEC (check out "View object on refcursor" example)
    Edit: you are aware that you can create a View Object based on more than one table?
    John

Maybe you are looking for