Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-574

DataObjectUtils 'objectForPK' should work on the client

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Undefined future, 1.2 branch, 2.0 branch, 3.0
    • 3.0M4, 3.0
    • Core Library
    • None

    Description

      While DataObjectUtil.objectForPK takes ObjectContext as an argument, using it on the remote client is not possible. The following exceptions happen on various overloaded calls:

      1. This will require method signature change:

      DataObjectUtils.objectForPK( c1,new ObjectId("MtTable1", "TABLE1_ID", 1));

      java.lang.ClassCastException
      at org.objectstyle.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:276)
      at org.objectstyle.cayenne.remote.ClientChannelEventsTst.testSyncSimpleProperty(ClientChannelEventsTst.java:93)

      2. This should issue a query instead of doing DbEntity lookup:

      DataObjectUtils.objectForPK(
      c2,
      ClientMtTable1.class,
      1);

      org.objectstyle.cayenne.CayenneRuntimeException: [v.@CAYENNE_VERSION@ @CAYENNE_BUILD_DATE@] No DbEntity for ObjEntity: MtTable1
      at org.objectstyle.cayenne.DataObjectUtils.buildId(DataObjectUtils.java:352)
      at org.objectstyle.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:167)

      Attachments

        Activity

          People

            nirvdrum Kevin Menard
            andrus Andrus Adamchik
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: