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

prefetch can set state to modified

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2 branch, 2.0 branch, 3.0
    • 3.0M1
    • Core Library
    • None
    • cayenne-2.0.2, java 5, a mac, PostgreSQL and Derby

    Description

      I have a situation where adding a prefetch to a simple select query set the persistence state to "modified" even though they are not modified. Here are the stacktrace to where the state are set to modified:

      at myapp.data.A.setPersistenceState(A.java:47)
      at org.apache.cayenne.access.ObjectStore.registerDiff(ObjectStore.java:167)
      at org.apache.cayenne.access.DataContext.propertyChanged(DataContext.java:1838)
      at org.apache.cayenne.CayenneDataObject.writeProperty(CayenneDataObject.java:227)
      at org.apache.cayenne.access.PrefetchProcessorNode.linkToParent(PrefetchProcessorNode.java:90)
      at org.apache.cayenne.access.ObjectTreeResolver$DisjointProcessor.startDisjointPrefetch(ObjectTreeResolver.java:359)
      at org.apache.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:167)
      at org.apache.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:180)
      at org.apache.cayenne.access.ObjectTreeResolver.resolveObjectTree(ObjectTreeResolver.java:87)
      at org.apache.cayenne.access.ObjectTreeResolver.synchronizedObjectsFromDataRows(ObjectTreeResolver.java:69)
      at org.apache.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:328)
      at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:116)
      at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:746)
      at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:217)
      at org.apache.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:54)
      at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1387)
      at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1376)

      Here are the query:
      DataContext ctxt = createDataContext();
      SelectQuery query = new SelectQuery(A.class);
      query.addPrefetch(A.B_PROPERTY);
      List daos = ctxt.performQuery(query);

      The relationship is a one-to-one and the primary key are compond of one String and 3 ints.

      Attachments

        Activity

          People

            halset Tore Halset
            halset Tore Halset
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: