0 Replies Latest reply on Sep 15, 2005 6:39 PM by jamesohearn

    Now what?  Consequences of using an unknown primary key...

    jamesohearn

      For type safety I am using a custom primary key class. I've got the XML that I expect but there are a few issues I'd like to iron out:

      1) What does my finder method look like now? The CMP field that I used to have ("ID") has been replaced by the unknown primary key: it specifies a field name = "ID" and a column name = C_ID". What does my "findByID()" finder look like now? The same?

      ex. (old) -- Select OBJECT(x) FROM tComponent AS x WHERE x.ID = ?1

      Should I use x.C_ID instead?

      2) Do I still need a getPrimaryKey() method? If so, how do I build the primary key class instance in the method without the old cmp field to refer to?

      old code:

      public Object getPrimaryKey() {
      ComponentPK key = new ComponentIntegerPK();
      key.ID = getID();
      return key;
      }

      There is no longer a getID() method because the CMP field "ID" no longer exists. What do I use for a value to assign to "key.ID"?

      By the way, is there anything else I've missed.

      I appreciate any input very much.

      Environment:

      Windows XP Professional
      JBoss 4.0.2
      Hypersonic DB