How does OpenJPA decide that a foreign key value should represent a null value instead of a reference to a nonexistent object?

I have a compound foreign key (three columns, all nullable) that are represented by an Oid. When I store a null reference, the columns are stored as nulls. When I retrieve the object, the foreign key is represented as an Oid with value {0, 0, ""}.

Where is it determined (source file and line number will help) that the Oid represents "null" and not a reference to an object (that doesn't exist)?

Thanks,

Craig

/** This class implements the object id for classes that have
* three primary keys: long, long, String. The key fields in the persistent
 * class must be named the same as the oid class:
 * longpk, intpk, and stringpk.
 */
public class LongIntStringOid extends LongIntStringConstants implements Serializable {

    public long longpk;

    public int intpk;

    public String stringpk;

    /** Needed for persistence oid contract. */
    public LongIntStringOid() {

    }
... other stuff omitted

mysql> select * from longintstringfk order by stringvalue;
+------------------+-------+----------+------------------+------- +----------+-------------+ | longpk | intpk | stringpk | longfk | intfk | stringfk | stringvalue | +------------------+-------+----------+------------------+------- +----------+-------------+ | 1000000000000000 | 0 | 1 | NULL | NULL | NULL | Value 10 | | 1000000000000000 | 1 | 0 | NULL | NULL | NULL | Value 12 | | 1000000000000000 | 1 | 1 | 2000000000000000 | 1 | 2 | Value 13 | | 1000000000000000 | 1 | 2 | 2000000000000000 | 1 | 1 | Value 14 | +------------------+-------+----------+------------------+------- +----------+-------------+
4 rows in set (0.06 sec)

2782 ndb WARN [main] openjpa.Runtime - Detected possible orphaned reference to deleted object "com.mysql.clusterj.jpatest.model.LongIntStringPKOneOne- LongIntStringOid[0,0,""]" in "com .mysql .clusterj.jpatest.model.LongIntStringFKOneOne.longIntStringPKOneOne".

Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:[email protected]
P.S. A good JDO? O, Gasp!

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to