Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
6 replies Latest Post - ‏2012-06-06T15:01:01Z by SystemAdmin
SystemAdmin
SystemAdmin
228 Posts
ACCEPTED ANSWER

Pinned topic Join in CM bases result on old versions of secondary table

‏2012-06-04T12:46:42Z |
I am running a query against Content Manager v. 8.4.1 from a Java-program, where I am joining table A and B on attribute b:

/A[@a="x" AND (@b=(/B

I have additionally specified DKConstant.DK_CM_PARM_RETRIEVE, new Integer(DKConstant.DK_CM_CONTENT_ITEMTREE_NO_LINKS + DKConstant.DK_CM_VERSION_LATEST).

The result is that I get a list of A instances in the latest version. However A instances are returned based on information from B instances that are not nessecarily in latest version. This is a problem that is worsened by the fact that all B versions are retained in DB2, when we delete B instances via the CM API. This means that a) deleted B instances have impact on the resultset of the query, and b) older versions of B instances have impact on the resultset of the query.

1) How can I change my query/parameters so that I get A's from a join with B where B instances considered are only in latest version?
2) How can we make our delete operation delete all versions in DB2? (note: a solution to 2 will not omit the need for a solution to 1)

Brgds.
  • SystemAdmin
    SystemAdmin
    228 Posts
    ACCEPTED ANSWER

    Re: Join in CM bases result on old versions of secondary table

    ‏2012-06-04T12:48:42Z  in response to SystemAdmin
    the full query should read:

    /A[@a="x" AND (@b=(/B
    • SystemAdmin
      SystemAdmin
      228 Posts
      ACCEPTED ANSWER

      Re: Join in CM bases result on old versions of secondary table

      ‏2012-06-04T12:50:19Z  in response to SystemAdmin
      /A[ @a="x" AND ( @b=( /B
      • SystemAdmin
        SystemAdmin
        228 Posts
        ACCEPTED ANSWER

        Re: Join in CM bases result on old versions of secondary table

        ‏2012-06-04T12:53:50Z  in response to SystemAdmin
        I seems to have problems posting the query. It is attached in a file instead.

        Attachments

        • SystemAdmin
          SystemAdmin
          228 Posts
          ACCEPTED ANSWER

          Re: Join in CM bases result on old versions of secondary table

          ‏2012-06-04T15:08:51Z  in response to SystemAdmin
          This is the expected behavior, as the DK_CM_VERSION_LATEST option only applies to the final result. You can achieve what you want to achieve by adding an additional condition to the predicate on B in the query. It would look something like this:

          /A[ @a="x" AND ( @b=( /B[ @b="y" AND @VERSIONID = latest-version(.)] ) /@b) ]