Problem using self-referencing type parameter

I seem to be having trouble using a self-referencing type parameter (or what's the name for it ;)
Please consider this code:
class Test<T extends Test<T>> implements ITest<T> {
     public T foo() {
          // does not work?!
          //return this;
          @SuppressWarnings("unchecked")
          T result = (T) this;
          return result;
interface ITest<T extends ITest<T>> {
     T foo();
}I need ITest.foo() to return T so that it would return the correct type when used in subinterfaces. I can see that Test.foo() must return T, so that is why I declared "T extends Test<T>".
Trouble is, why does "this", which also implements ITest<T>, not satisfy the requirement of returning T?

This is a common question. The problem is a flawed assumption about the declaration of ITest.
The assumption is that:
interface ITest<T extends ITest<T>>means that any implementation of ITest must be parameterized by itself. This is not the case.
Consider the following
public class Test<T extends Test<T>> implements ITest<T> {
    public static void main(String[] args){
        Bar b = new Foo().foo();
    public T foo() {
        @SuppressWarnings("unchecked")
        T result = (T) this;
        return result;
class Foo extends Test<Bar> {
class Bar extends Test<Bar>{
interface ITest<T extends ITest<T>> {
}Compiles and then fails with a classcastexception.
Look again at ITest. The generic declaration requires that implementations are parameterized by self-parameterized instances of Test. That's different than saying the implementation itself is self-parameterized. The distinction is subtle but in the end you cannot declare classes that force sublcasses to be self-parameterized.
You can, however, declare methods that force their arguments to be self-parameterized.

Similar Messages

  • Problem with self referencing cells

    Hello there,
    I'd like to have two columns that are NULL, unless the other column has a value entered into it.
    This seems to create an infinite lookup loop of self referencing.
    Can anyone suggest a work around?
    Please see example
    http://public.iwork.com/document/?a=p175104233&d=self_reference.numbers

    If for instance you have
    cell B2 = IF(C2="","","Not Null")
    and
    cell C2 = IF(B2="","", "Not Null")
    then, yes, you have a circular reference
    It sounds like what you want is if you enter (by hand, overwriting the formula that is there) a value in B2 then the formula in C2 will result in a value (not null). If you, instead, enter a value in C2 then the formula in B2 will result in a value.
    Try this addition to the formula:
    B2=IFERROR(IF(C2="","","not null"),"")
    C2=IFERROR(IF(B2="","","not null"),"")
    In other words, wrap it all up in an IFERROR
    Message was edited by: Badunit

  • Use wildcards or type parameter?

    Hello all,
    please consider these declarations:
    interface TaskListener<T>
    // methods omitted for clarity
    interface Task<T>
    void addTaskListener(TaskListener<? super T>  listener);
    // other methods omitted for clarity
    }I was trying to implement the interface TaskListener as shown below, and I found that only version 2 compiled, whereas version 1 did not. Shouldn't these two be equivalent?
    class TaskGroup<T> implements TaskListener<T>
    // Version 1 (does not compile)
    public void addTask(Task<? extends T> task)
    task.addTaskListener(this);
    // other code omitted for clarity
    // Version 2 (this one compiles)
    public <S extends T> addTask(Task<S> task)
    task.addTaskListener(this);
    // other code omitted for clarity
    }

    Yes, they should be equivalent. We're working on it.Cool!
    So the whole "wildcard stuff" is at least soundly integrated into the Type Parameter System and can even be understood by humble programmers like myself ;-)
    And thanx for the quick reply!

  • Problem with setting oracle type parameter in viewobject query

    Hi There,
    I am facing a problem with JDev1013. I have a view that has JDBC positional parameters that are supposed to be in parameters for function like:
    SELECT x.day, x.special_exact_period_only
    FROM (
      SELECT x.day, x.special_exact_period_only
      FROM (
        SELECT
          x.day,
          rb.special_exact_period_only
      FROM TABLE (
        RentabilityPkg.findMarkerSlots(
          'start',
          ? /* dchannel */,
          NULL,
          ? /* resorts */,
          'special',
          NULL,
          ? /* code */,
          NULL,
          TRUNC(SYSDATE),
          TRUNC(SYSDATE + 365 * 2),
          NULL
      ) x
        JOIN resourcebase rb USING (rentabilitymanager_id)
        UNION
        SELECT
          x.day,
          rb.special_exact_period_only
        FROM TABLE (
          RentabilityPkg.findMarkerSlots(
            'start',
            ? /* dchannel */,
            NULL,
            ? /* resorts */,
            'composition',
            NULL,
            ? /* code */,
            NULL,
            TRUNC(SYSDATE),
            TRUNC(SYSDATE + 365 * 2),
            NULL
        ) x
        JOIN resourcebase rb USING (rentabilitymanager_id)
      )x
      ORDER BY x.day
    ) x
    WHERE ROWNUM <= 30now the JDBC positional parameters take our custom defined list type defined as:
    CREATE TYPE NumberList AS TABLE OF NUMBER;
    we are setting the parameter in the views with the help of oracle.sql.ARRAY class like:
       * Set parameters.
      public void setParams(Integer dchannelId, Integer[] resorts, String specialCode)
        try {
              System.out.println(this.getClass() + ".setParams()");
              ARRAY arrParam1 = ((NWSApplicationModule)getApplicationModule()).toSQLNumberList(Arrays.asList(resorts));
              ARRAY arrParam2 = ((NWSApplicationModule)getApplicationModule()).toSQLNumberList(Arrays.asList(resorts));
              System.out.println("arrParam1 - " + arrParam1);
              System.out.println("arrParam1 - " + arrParam1);
              System.out.println(this.getClass() + " ARRAY - " + arrParam1.getArray());
              System.out.println(this.getClass() + " -- " + arrParam1.length());
              System.out.println("arrParam2 - " + arrParam2);
              System.out.println("arrParam2 - " + arrParam2);
              System.out.println(this.getClass() + " ARRAY - " + arrParam2.getArray());
              System.out.println(this.getClass() + " -- " + arrParam2.length());
              Object[] params =
                   { dchannelId,
                        arrParam1,
                        specialCode,
                        dchannelId,
                        arrParam2,
                        specialCode
              setWhereClauseParams(params);
              System.out.println("DONE WITH " + this.getClass() + ".setParams()");
        catch(Exception ex)
              ex.printStackTrace(System.out);
      }the toSQLNumberList() method is defined in our App module baseclass as follows:
      public ARRAY toSQLNumberList(Collection coll)
           debug("toSQLNumberList()");
           DBTransaction txn = (DBTransaction)getTransaction();
           debug("txn - " + txn + " : " + txn.getClass());
           return NWSUtil.toSQLNumberList(coll, getConnection(txn));
      public static ARRAY toSQLNumberList(Collection c, Connection connection)
        //printTrace();
        debug("toSQLNumberList()");
        try
          ArrayDescriptor numberList = ArrayDescriptor.createDescriptor("NUMBERLIST", connection);
          NUMBER[] elements = new NUMBER[c == null ? 0 : c.size()];
          if (elements.length > 0 )
            Iterator iter = c.iterator();
            for (int i = 0; iter.hasNext(); i++)
              elements[i] = new NUMBER(iter.next().toString());
          return new ARRAY(numberList, connection, elements);
        catch (Exception ex)
          ex.printStackTrace();
          return null;
      protected Connection getConnection(DBTransaction dbTransaction)
        //return null;
        debug("Inside getConnection()");
        CallableStatement s = null;
        try
           * Getting Conenction in BC4J is dirty but its better
           * as otherwise we might end up coding with connections
           * and the Transaction Integrety will be
          s = dbTransaction.createCallableStatement("BEGIN NULL; END;", 0);
          debug("DOING s.getConnection()...");
          Connection conn = s.getConnection();
          debug("DONE WITH  s.getConnection()...");
          /*try
                throw new Exception("TEST");
           catch (Exception ex)
                ex.printStackTrace(System.out);
          debug("conn CLASS - " + conn.getClass());
          return conn;
        catch (Exception ex)
          ex.printStackTrace();
          return null;
        finally
          try { s.close(); }
          catch (Exception ex) {}
      }Whenever we try setting the parameters in view using setParams() and use this view to set the model of a java control it thorws the following exception :
    [2006-10-10 12:34:48,797 AWT-EventQueue-0 ERROR] JBO-28302: Piggyback write error
    oracle.jbo.PiggybackException: JBO-28302: Piggyback write error
         at oracle.jbo.common.PiggybackOutput.getPiggybackStream(PiggybackOutput.java:185)
         at oracle.jbo.common.JboServiceMessage.marshalRefs(JboServiceMessage.java:267)
         at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:343)
         at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:316)
         at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processMessage(AbstractRemoteApplicationModuleImpl.java:2283)
         at oracle.jbo.server.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:7509)
         at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.sync(AbstractRemoteApplicationModuleImpl.java:2221)
         at oracle.jbo.server.remote.ejb.ServerApplicationModuleImpl.doMessage(ServerApplicationModuleImpl.java:79)
         at oracle.jbo.server.ejb.SessionBeanImpl.doMessage(SessionBeanImpl.java:474)
         at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.TxBeanManagedInterceptor.invoke(TxBeanManagedInterceptor.java:53)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.StatefulSessionEJBObject.OC4J_invokeMethod(StatefulSessionEJBObject.java:840)
         at RemoteAMReservation_StatefulSessionBeanWrapper906.doMessage(RemoteAMReservation_StatefulSessionBeanWrapper906.java:286)
         at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    ## Detail 0 ##
    java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
         at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)
         at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
         at oracle.jbo.common.SvcMsgResponseValues.writeObject(SvcMsgResponseValues.java:116)
         at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
         at oracle.jbo.common.PiggybackOutput.getPiggybackStream(PiggybackOutput.java:173)
         at oracle.jbo.common.JboServiceMessage.marshalRefs(JboServiceMessage.java:267)
         at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:343)
         at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:316)
         at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processMessage(AbstractRemoteApplicationModuleImpl.java:2283)
         at oracle.jbo.server.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:7509)
         at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.sync(AbstractRemoteApplicationModuleImpl.java:2221)
         at oracle.jbo.server.remote.ejb.ServerApplicationModuleImpl.doMessage(ServerApplicationModuleImpl.java:79)
         at oracle.jbo.server.ejb.SessionBeanImpl.doMessage(SessionBeanImpl.java:474)
         at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.TxBeanManagedInterceptor.invoke(TxBeanManagedInterceptor.java:53)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.StatefulSessionEJBObject.OC4J_invokeMethod(StatefulSessionEJBObject.java:840)
         at RemoteAMReservation_StatefulSessionBeanWrapper906.doMessage(RemoteAMReservation_StatefulSessionBeanWrapper906.java:286)
         at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)This is a typical interaction between 2 server-side components (view-object and app module). Now the question is why is this exception thrown? Any answers?
    This application is one that we have migrated from 904 to 1013 and are trying to get it running in 3-tier.
    Regards,
    Anupam

    Sorry I missed out some semicolons, the script follws:
    -- The following TABLE was created to simulate the issue
    CREATE TABLE TEST_OBJECT
         ASSET_ID NUMBER,
         OBJECT_ID NUMBER,
         NAME VARCHAR2(50)
    INSERT INTO TEST_OBJECT VALUES(1,1,'AAA');
    INSERT INTO TEST_OBJECT VALUES(2,2,'BBB');
    INSERT INTO TEST_OBJECT VALUES(3,3,'CCC');
    COMMIT;
    SELECT * FROM TEST_OBJECT;
    -- The following TYPES was created to simulate the issue
    CREATE OR REPLACE
    TYPE DUTYRESULTOBJECTTAB AS TABLE OF DUTYRESULTOBJECT;
    CREATE OR REPLACE
    type DutyResultObject as object
    ( ASSET_ID number,
      OBJECT_ID number,
      NAME varchar2(150)
    -- The following PACKAGE N FUNCTION was created to simulate the issue
    CREATE OR REPLACE PACKAGE TESTOBJECTPKG
    IS
         FUNCTION OBJECTSEARCH(P_RESOURCE IN NUMBERLIST) RETURN DUTYRESULTOBJECTTAB;
    END;
    CREATE OR REPLACE PACKAGE BODY TESTOBJECTPKG
    IS
         FUNCTION OBJECTSEARCH(P_RESOURCE IN NUMBERLIST) RETURN DUTYRESULTOBJECTTAB
         IS
           BULKDUTYRESULTOBJECTTAB DUTYRESULTOBJECTTAB;
         BEGIN
           SELECT DUTYRESULTOBJECT(ASSET_ID, OBJECT_ID, NAME)
           BULK COLLECT INTO BULKDUTYRESULTOBJECTTAB
           FROM TEST_OBJECT;
           RETURN BULKDUTYRESULTOBJECTTAB;
         END;
    END;
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem using logical port type "ABAP"

    Hi, my problem is that I have to save a txt file  with a certanly format who feeds from an IDOCs that is sended nowhere.
    Instead of using a BADI the client wants that every time a PO is liberated an IDOC has to be triggered and it has to save that txt in a path, but that IDOC is not sended anywhere is just for saving the file. Dont ask why... they want to do this approach.
    So I created a logical port of type ABAP, copy the function "OWN_FUNCTION" as a template and in my custom function I parse the IDOC and save the file... it works. My problem is that the IDOC is created when a PO is created but not triggered !!!
    The IDOC is created with status 30 (ready to send).
    What I need is that when the PO is saved the file has to be generated in the server but the function is not triggered. I try running the Program RSEOUT00 and the IDOC is not found (dont know why) the only way I can trigger the IDOC is via BD87.
    Someone could help me, I dont know why the logical port type ABAP is not triggered. all my setting in WE20 is right.
    Thx

    The problem was in the WE20, the radio button was in mode 4 (collect IDOCs) instead of 2 (send inmediatly)

  • Problem using Oracle Object Types and Arrays.

    I'm currently trying to work with oracle object types in java and I'm running into some issues when trying to add an item to an array.
    The basic idea is that I have a header object and a detail object (both only containing an ID and a description). Inside of my java code I'm trying to add a new detail line to the header that has been retrieved from the database.
    Here's what I'm working with.
    --Oracle Objects:
    CREATE OR REPLACE TYPE dtl_obj AS OBJECT
        detail_id INTEGER,
        header_id INTEGER,
        detail_desc VARCHAR2(300)
    CREATE TYPE dtl_tab AS TABLE OF dtl_obj;
    CREATE OR REPLACE TYPE hdr_obj AS OBJECT
        header_id INTEGER,
        src VARCHAR(30),
        details dtl_tab
    CREATE TYPE hdr_tab AS TABLE OF hdr_obj;
    /--Java test methods
         public static void main(String[] args) throws SQLException,
                   ClassNotFoundException
              // Initialize the objects
              Test t = new Test();
              t.connect(); //Connects to the database
              //The oracle connection will be accessible through t.conn
              // Create the oracle call
              String query = "{? = call get_header(?)}";
              OracleCallableStatement cs = (OracleCallableStatement) t.conn.prepareCall(query);
              cs.registerOutParameter(1, OracleTypes.ARRAY, "HDR_TAB"); //Register the out parameter and associate it with our oracle type
              int[] hdrs = { 240 }; //we just want one for testing.
              ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor(
                        "ARRAY_T", t.conn);
              oracle.sql.ARRAY oHdrs = new ARRAY(descriptor, t.conn, hdrs);
              cs.setARRAY(2, oHdrs); //Set the headers to retrieve
              // Execute the query
              cs.executeQuery();
              try
                   ARRAY invArray = cs.getARRAY(1);
                   // Start the retrieval process
                   Class cls = Class.forName(Header.class.getName());
                   Map<String, Class<?>> map = t.conn.getTypeMap();
                   map.put(Header._SQL_NAME, cls);
                   Object[] invoices = (Object[]) invArray.getArray();
                   ArrayList<Header> invs = new ArrayList(
                             java.util.Arrays.asList(invoices));
                   if (invs != null)
                        for (Header inv : invs)
                             System.out.println(inv.getHeaderId() + " " + inv.getSrc());
                             t.addDetail(inv, "new line");
                             for (Detail dtl : inv.getDetails().getArray()) // Exception thrown here
    //                              java.sql.SQLException: Fail to construct descriptor: Invalid arguments
    //                              at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    //                              at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
    //                              at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:861)
    //                              at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:128)
    //                              at oracle.jpub.runtime.MutableStruct.toDatum(MutableStruct.java:109)
    //                              at com.pcr.tst.Detail.toDatum(Detail.java:40)
    //                              at oracle.jpub.runtime.Util._convertToOracle(Util.java:151)
    //                              at oracle.jpub.runtime.Util.convertToOracle(Util.java:138)
    //                              at oracle.jpub.runtime.MutableArray.getDatumElement(MutableArray.java:1102)
    //                              at oracle.jpub.runtime.MutableArray.getOracleArray(MutableArray.java:550)
    //                              at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:689)
    //                              at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:695)
    //                              at com.pcr.tst.DetailTable.getArray(DetailTable.java:76)
    //                              at com.pcr.tst.Test.main(Test.java:91)
                                  System.out.println(dtl.getDetailDesc());
              catch (Exception ex)
                   System.out.println("Error while retreiving header");
                   ex.printStackTrace();
              public void addDetail(Header hdr, String desc) throws Exception
              if (hdr == null)
                   throw new Exception("header not initialized");
              // Convert the current list to an ArrayList so we can easily add to it.
              ArrayList<Detail> dtlLst = new ArrayList<Detail>();
              dtlLst.addAll(java.util.Arrays.asList(hdr.getDetails().getArray()));
              // Create the new detail
              Detail dtl = new Detail();
              dtl.setDetailDesc(desc);
              // add the new detail
              dtlLst.add(dtl);
              Detail[] ies = new Detail[dtlLst.size()];
              ies = dtlLst.toArray(new Detail[0]);
              DetailTable iet = new DetailTable(ies);
              hdr.setDetails(iet);
         }I know its the addDetail method causing the issue because if I comment out the t.addDetail(inv, "new line"); call it works fine.
    Message was edited by:
    pcristini

    Oracle® Database Object-Relational Developer's Guide
    Also note that object relational database design is often less performant and scalable than relational. It is not very often used in production environments.
    However, the object orientated programming feature that is provided with Oracle object feature set are used and can make development and interfaces a lot easier.
    So in a nutshell. Say no to ref and nested table columns. Say yes to most of the other object features. IMO of course...

  • Problem using Null as a parameter with a stored procedure

    Hello All,
    We're are having an issue with a Crystal Report using a Stored procedure.
    The procedure has been created to be able to hande the null value as an input. When generating the report within the Crystal designer everything works when selecting the null checkbox. The reports is doing what is to be expected.
    When using a Java program to generate this report we receive a JavaException
    Caused by: java.lang.IllegalArgumentException: Invalid argument type
         at com.crystaldecisions.sdk.plugin.desktop.common.internal.w.setValue(Unknown Source)
    Any idea if something specific/different needs to be done whenb comparing this to regular generation of reporting within a Java application.
    Kind Regards

    You will need to convert your table into an IProcedure object.  This will allow you to pass parameters directly to your stored procedure.
    Try something like this:
    if(table instanceof com.crystaldecisions.sdk.occa.report.data.Procedure)
       IProcedure command = (IProcedure)table;
       Fields parameterFields = (Fields)command.getParameters();
       ParameterField commandParam = (ParameterField)parameterFields.get(0);
       Values values = new Values();
       ParameterFieldDiscreteValue pfdv = new ParameterFieldDiscreteValue();
       pfdv.setValue(new Integer(1));
       values.add(pfdv);
       commandParam.setCurrentValues(values);

  • Very long materialized view refresh when using self-referencing table

    hi,
    I have the following query, that takes 15 sec. to execute. When building a materialized view for it, the refreshing process doesn't stop for hours. The result of the query are about 500 rows and the tables contain not more than some 1000 rows, so it's a really simple query.
       SELECT a.A,
              b.B,
              c.C
         FROM (SELECT *
                 FROM (SELECT a
                         FROM TableA)) a,
              (SELECT b
                 FROM TableA
                WHERE type = 3) b,
              (SELECT c
                 FROM TableA) c
        WHERE TRIM (a.x) = TRIM (b.y) AND b.z = c.w;I think it has something to do with the fact, that the same table is used 3 times in the query. When I look in the trace I see that the following statement is executed:
    INSERT   /*+ BYPASS_RECURSIVE_CHECK */
          INTO                                DM.Test_MV
       SELECT ...What is the + BYPASS_RECURSIVE_CHECK / hint doing? Can I deactivate it somehow?
    And why is there any difference between the query execution and the query execution when refreshing the mat view?
    Thanks for your help!

    5 digit version no? lots of bugs with mviews out there.
    theres a specific note (not a bug) on support 1115148.1 that references that hint though, so try dropping and recreating the view before refreshing.

  • Generics------type parameter

    Hi,
    I have a question about following code.
    public class A<T1 extends Thread> {
    public class B<T1 extends Thread> extends A<T1> {
    public class D<T4<T1 extends Thread> extends A<T1>> {
    }My question: Why class D can't compile?
    And how can I get the T1 in D?
    I need T1 in class D

    Thank you very much.
    Maybe I shouldn't write the class B above
    The class B and Thread are only examples.
    Nothing relatee them.
    I rewrite the code example:
    public interface SomeInterface {
    public class A<T extends SomeInterface> {
    public class B <T2<T extends SomeInterface> extends A<T>>{
    }OR:
    public class B <T2<T> extends A<T extends SomeInterface>>{
    B can't compile.
    B has a type parameter T2 extended from A
    How to define B?
    I want use the the type parameter T of A in B.

  • Problem using IDOC_INPUT_DELVRY in ship.conf for msg type SHPCON

    Hi Experts,     
    We are confirming the picked quantity from warehouse for the outbound delivery using the EDI  IDOC_INPUT_DELVRY as shipping confirmation using message type SHPCON and process code DELV.
               Problem is that this process is checking the determination of the output type LAVA maintained in NACE before the actual post goods issue take place. since the SAP itself has the requirement check for goods issue status 'C' ( Complete check status ), this output type is not picked while doing the automatic post goods issue using EDI since at that time goods issue status is 'A'. In other words, goods issue has not taken place.
           But when we did manually using VL02N for confirmed picked quantity and did the post goods issue manually it is determining the output type LAVA since while checking the requirement in LAVA has goods issue status 'C' ( Completed ).
    In simple words, while doing manually the output type LAVA is determined but while doing
    automatic post goods issue using EDI output type LAVA is not determined.
    This is very urgent. Please help with this?.
    Thanks,
    suresh

    Hello Mohanaselvan,
    Thank you for this info.  Definitely making some progress now.
    Can you advise some of the necessary iDOC DELVRY03 data elements necessary to transmit the sales order data?
    I am receiving the 51 status error message:
    "Data of Preceding Document was not transmitted" and
    "Essential transfer parameters are missing"
    I tried referencing the Sales Order in few places, but I don't seem to have it correct:
    E1EDL20-VBELN = Sales Order (Instead of Delivery Number)
    AT ITEM LEVEL
    E1EDL43-QUALF=C
    E1EDL43-BELNR=Sales Order
    E1EDL43-POSNR=Sales Order Item Number
    Regards,
    Sandy

  • Oracle 9i Object Type ..using self

    I have created and object with
    several attributes of standard oracle datatypes. I have one that is of a custom object type. this object provides encapsulated functionality. I instansiate the internal custom object using a constructor function. the constructor includes the creation of a primary key. once the constructor is done, the object is initialized( an internal flag is set, which should only be done once)
    To use this custom object in a member method, I have to do something like this..
    ( i have summarized code for brevity)
    MEMBER FUNCTION foo( ) return obj
    is
    l_self PARENT_OBJ_TYPE:= SELF;
    local INTERNAL_OBJ :=SELF.internal_obj;
    begin
    local.method1() -- insert record( flag is true)
    local.method1() --insert another record( but this time the flag that was set upon construction is now set to FALSE..
    I get an error.)
    end;
    I do not do anything tricky. the behavior seems to be that object types do not keep state appropriately.
    any ideas of why this could be happening?

    there was no real error code just unexpected behavior. it did not crash. I figured it out. it had to do with passing self as a parameter in out so that it keeps state

  • Problem using default value of report parameter 1 to validate parameter 2 passed in to report

    I am having a problem with an SSRS report using the default value of report parameter 1 to validate parameter 2 passed in to report (via C#) instead of using the value of parameter 1 that is also passed into the report.  Here are the
    simplified details:
    Using SSDT, SQL Server 2008 R2
    SSRS report has 2 parameters:
    P1 -- text, hidden, default value 'R1', ... front-end C# code can pass 'R2' or 'R1'
    P2 -- text, allows multiple values, list of available values provided by stored procedure (sproc_list) that takes P1 value as a parameter.  Hence, sproc_list either provides a list for P1 = 'R1' or P1 = 'R2'.
    List for P1 = 'R1' is 'A', 'B', 'C'
    List for P1 = 'R2' is 'A', 'B', 'D'
    Values for P1 and P2 can be passed in via C# to the report.
    The C# front-end displays 2 report choices to the user, R1 and R2, where both choices call the same RDL; but choice R1 passes in 'R1' for P1, and the choice R2 passes in 'R2' for P1.
    Upon a users 1st time use of the report no parameters are passed in.  Then when the user exits the report, the parameter value for P2 that was chosen is saved off to a file for R1 or R2, and used the next time the user selects the report.
    Everything always works fine for report R1 since the default value for P1 is 'R1'.
    When R2 is chosen and the user selects 'D' as the value for P2, runs the report, then exits, the P2 value of 'D' for R2 is saved to a file.  When the user returns the next day to run report R2, 'R2' is passed for P1, and 'D' is passed for P2.
    This is when the problem occurs.  The value of 'D' for P2 is validated against a list generated for P2 based on the default value of 'R1' for parameter P1.  Hence, SSRS considers 'D' an invalid value for P2 and blanks out the P2 parameter. 
    The user can then use the drop down list for P2 and choose 'D', but this defeats the purpose of saving the parameter values to be used the next time.
    Why is the stored procedure that provides a list of available values for parameter P2 using the default value of 'R1' for parameter P1 instead of using the value of 'R2' passed into the report for parameter P1?

    Hi Tom,
    Sorry for my delay.
    If I understand correctly, you have two parameter in your report. It is a couple of cascading parameter. If we have choose ‘R1’ of P1, the P2 values is A, B, C. ‘R2’ of P1, corresponding P2 values is A, B, D. What your requirement is to save the end use
    select option of these two parameters.
    In SSRS, if we have configure the parameter with default value. When we run the report, the parameter will fill with the default value to filter data. If we want to save the last status we are render the report, we need to update the default value of P1.
    If we are query the default value from database, if possible, we can
    update the database try to resolve the issue.  Alternatively, we can set the dynamic default value for the parameter.
    Hope this helps.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • Problems using event structure to write new parameter values to VISA

    Attachments:
    FMA_event_2.vi ‏28 KB
    FMA_event_2.vi ‏28 KB

    It seems I'm also having trouble using forums..not sure what happened...updated and corrected thread: http://forums.ni.com/t5/LabVIEW/Problems-using-event-structure-to-write-new-parameter-values-to/td-p...

  • Exception: "The type "Collection" as used in the variable/parameter declarations

    I am getting the following exception when I try to run the test code.
    What could be causing it ?
    I am running Kodo 2.4.3 with JDK 1.4.1
    EXCEPTION
    javax.jdo.JDOFatalInternalException: [agencyNames:[AGENCY1, AGENCY2]]
    NestedThrowables:
    javax.jdo.JDOUserException: The type "Collection" as used in the
    variable/parameter declarations could not be found in the imports.
    TEST CODE
    JDOFactory jdoFactory = new JDOFactory();
    PersistenceManager pm = jdoFactory.getPersistenceManager("");
    try
    Class agencyClass = Agency.class;
    Extent agencyExtent = pm.getExtent(agencyClass, false);
    String filter = "agencyNames.contains(agencyName)";
    List agencyNames = Arrays.asList(new String[]{"AGENCY1",
    "AGENCY2"});
    String param = "Collection agencyNames";
    Query q = pm.newQuery(agencyExtent, filter);
    q.declareParameters(param);
    Collection deps = (Collection) q.execute(agencyNames);
    System.out.println("SIZE :" + deps.size());
    catch (Exception ex)
    ex.printStackTrace();
    JDO Mapping and Class
    package test;
    import java.util.*;
    public class Agency
    private String agencyName;
    private String hostCarrierCode;
    //Getter and Setter
    public static class Id
    public String agencyName;
    public String hostCarrierCode;
    //Application ID definition
    ?xml version="1.0"?>
    <jdo>
    <package name="test">
    <class name="Agency" identity-type="application"
    objectid-class="Agency$Id">
    <extension vendor-name="kodo" key="table" value="AGENCIES"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <field name="agencyName" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="AGENCY_NAME"/>
    </field>
    <field name="hostCarrierCode" primary-key="true" >
    <extension vendor-name="kodo" key="data-column"
    value="CARRIER_CODE"/>
    </field>
    </class>
    </package>
    </jdo>

    Kodo 2.4.3 does not support using collections as parameters.
    Kodo 2.5.0, due to be released shortly, does support this. See
    http://solarmetric.com/Software/beta/2.5.0 to get the latest release
    candidate.
    -Patrick
    On Thu, 05 Jun 2003 22:26:36 +0000, B K Adarsh wrote:
    I am getting the following exception when I try to run the test code.
    What could be causing it ?
    I am running Kodo 2.4.3 with JDK 1.4.1
    EXCEPTION
    javax.jdo.JDOFatalInternalException: [agencyNames:[AGENCY1, AGENCY2]]
    NestedThrowables:
    javax.jdo.JDOUserException: The type "Collection" as used in the
    variable/parameter declarations could not be found in the imports.
    TEST CODE
    JDOFactory jdoFactory = new JDOFactory();
    PersistenceManager pm = jdoFactory.getPersistenceManager("");
    try
    Class agencyClass = Agency.class;
    Extent agencyExtent = pm.getExtent(agencyClass, false);
    String filter = "agencyNames.contains(agencyName)";
    List agencyNames = Arrays.asList(new String[]{"AGENCY1",
    "AGENCY2"});
    String param = "Collection agencyNames";
    Query q = pm.newQuery(agencyExtent, filter);
    q.declareParameters(param);
    Collection deps = (Collection) q.execute(agencyNames);
    System.out.println("SIZE :" + deps.size());
    catch (Exception ex)
    ex.printStackTrace();
    JDO Mapping and Class
    package test;
    import java.util.*;
    public class Agency
    private String agencyName;
    private String hostCarrierCode;
    //Getter and Setter
    public static class Id
    public String agencyName;
    public String hostCarrierCode;
    //Application ID definition
    ?xml version="1.0"?>
    <jdo>
    <package name="test">
    <class name="Agency" identity-type="application"
    objectid-class="Agency$Id">
    <extension vendor-name="kodo" key="table" value="AGENCIES"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <field name="agencyName" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="AGENCY_NAME"/>
    </field>
    <field name="hostCarrierCode" primary-key="true" >
    <extension vendor-name="kodo" key="data-column"
    value="CARRIER_CODE"/>
    </field>
    </class>
    </package>
    </jdo>--
    Patrick Linskey
    SolarMetric Inc.

  • Using a type parameter at the 'wrong' time?

    I tried to make a subclass of SwingWorker using...
    private class ProcessSAV<Void, String> extends SwingWorker {...}...and in the doInBackground() method, I declared and initialized a local variable...
    String filename = "blahblahblah";Somehow, I manage to get an incompatible types compile-time error at this line of code.
    found: java.lang.String
    required: String
    I know that the second type parameter is used to the specify the object type in publish() as well as the List type in process(). When I declare a String as the local variable in this instance, it seems to be a unique type related the second type argument and won't accept anything that returns a java.lang.String.
    Why is it doing this? And is there any way to get around it?

    You created two type parameters having the names of classes, thus the String you refer to actually is a type parameter, not the String class.
    You most probably wanted to do the following:private class ProcessSAV extends SwingWorker<Void, String> {...}

Maybe you are looking for

  • ITunes deletes everything from iPod Touch when I try to sync.

    This has happened to me five times now, and I am incredibly frustrated. When I start to sync my iPod Touch with iTunes, instead of actually syncing it deletes everything from my iPod (music, videos, podcasts, audiobooks, etc.; apps and other data are

  • Closing open orders

    Hi, Can someone help explain the following?: If I click delivery complete on an item to close a PO, will the system try to reorder the material if qty is below safetystock? Does a the workorder have to be open? Thanks, Rob

  • Help with VARRAY in PL/SQL

    I wrote the below Stored Procedure in a package. I am not able to execute this, can anyone please help Package Definition: CREATE OR REPLACE PACKAGE "CDS_SUBLIMIT_TYPE_PKG" as TYPE COLLATERAL_ARRAY is VARRAY(100) OF NUMBER(29); procedure get_original

  • Setlling interal order

    Dear All, When we settle the internal order with KO8G the following entry is generated 611013 Expense (P&L) Account 28 453 960.08 731000 Transfer account 119 659 770.10 u2013 731100 Transfer account 64 478 186.98 u2013 284200 Asset under construction

  • Multiple keyword search

    Hi all. Can anyone help me with the following? I have a search field where a user can enter more than one keyword. The keyword then is matched to one of 20 fields in the database. This works fine as long as only one keyword is entered, however I am h