problem setting 1: n relationship

From: johannes schmidt (e002753..tudent.tuwien.ac.at)
Date: Thu May 22 2003 - 05:30:22 EDT

  • Next message: Mario.Link..fi-lsa.de: "DB2 Adapter Problem"

    hi,
    i'm stuck with a problem:
    i've got two tables in my database
    PLZ and Adress.
    PLZ contains the city code + city name, adress contains adresses of people.
    so i have to link one adress to one PLZ (it's an 1 to n relationship
    PLZ:Adress)
    If I create (in JAVA) a new PLZ object and a new Adress Object I can
    perfectly set the relationship by using Adress.setPLZ(p).(p was first
    initialized and the attributes were set) When using ctxt.commitChanges the
    object is saved to the database without any problem.
    But when I retrieve the PLZ object from the database using a query (see the
    code at the end of this mail), I get the following Exception:
    java.lang.IllegalStateException: An attempt to use uninitialized
    DataObjectMatchTranslator: [attributes: null, values: {PLZ=-474230981}]

    Does anybody know what my problem is all about?

    //ctxt created...
      SelectQuery query = new SelectQuery(PLZ.class);
      Expression qual = ExpressionFactory.likeIgnoreCaseExp("PLZ","%"+"%" );
      SelectQuery select = new SelectQuery(PLZ.class, qual);
      List PLZs = ctxt.performQuery(query);
    PLZ p=(PLZ)PLZs.get(1);
    System.out.println(p); //The object-information is allright!
      this.db.setStrasze(this.tfStrasse.getText());
      this.db.setTelefon(this.tfTelefon.getText());
    //until here the code works perfectly

    --->>>>> on this line the exception is thrown!!! this.db.setPLZ(p);



    This archive was generated by hypermail 2.0.0 : Thu May 22 2003 - 05:29:46 EDT