4 Replies Latest reply on Oct 14, 2005 2:24 PM by djclarke

    IndirectList: not instantiated

      Just getting started with Toplink so I might have missed something obvious...

      Get this error message "IndirectList: not instantiated". Have a Class A which holds a Vector of B:s in it.
      This is the equvalient the two tables having a mapping table which maps A to any amount of B.

      In toplink they have a M2M mapping type, with Transparant Indirection turned on.

      The message appear when I do this
      A a = (A) unitOfWork.readObject(A.class, new ExpressionBuilder().get("id").equal("1000"));

      Have I missed any type in instansiation or similar?

        • 1. Re: IndirectList: not instantiated
          Hi Jan,

          Can you ensure that your Vector has been initialized. One easy check would be to lazily initialize it:
          Vector myCollection = new Vector();

          • 2. Re: IndirectList: not instantiated
            This is not an error message, this is the toString, the indirect list toString avoids instantiating the collection so prints this. To force it to instantiate first you can send it a message such as size().
            • 3. Re: IndirectList: not instantiated
              i instantiated my vector in the java object, and still receive the same error
              • 4. Re: IndirectList: not instantiated
                I would just like to re-iterate that the output you are seeing "IndirectList: not instantiated" is NOT an error message. The print instruction you have called results in the toString being invoked on the indirect collection. We have specifically coded the Indirect collection types to not instantiate their collections when a toString is invoked. This could lead to an unexpected performance issue.

                If you want the printing of your objects to instantiate the indirect collection then I would recommend writing a toString method on your class that forces this to happen. With an indirect collection you need to access the collection values themselves to force it to be read in. The easiest way of doing this would be to call size() on the indirect collection.