0

I'm working on a Java project which is connected to documentum . I am trying to fetch some data from my dm_acl object table using the following :

String fetchAclsInfoQuery = "select * from dm_acl where description = '@aclname0' or description = '@aclname1' or description = '@aclname2' enable (ROW_BASED) ";
            fetchAclsInfoQuery = fetchAclsInfoQuery.replace("@aclname0", list.get(0));
            fetchAclsInfoQuery = fetchAclsInfoQuery.replace("@aclname1", newAcl1.toString().toLowerCase());
            fetchAclsInfoQuery = fetchAclsInfoQuery.replace("@aclname2", newAcl2.toString().toLowerCase());
            System.out.println(fetchAclsInfoQuery);

//The problem starts from here  ==> 
            IDfQuery aclDetailsFetching = new DfQuery();
            //IDfCollection col = UpdateQuery.execute(_session, IDfQuery.DF_QUERY);
            IDfCollection details = aclDetailsFetching.execute(_session, DfQuery.DF_READ_QUERY);
            while(details.next()){
                System.out.println(details.getString("owner_name"));
            }

once I print out the results of "fetchAclsInfoQuery" and run it in DQL tester it works perfectly fine how ever when I try to out put the values stored in "owner_name" column all I get is null . Any idea where my mistake is ? :)

Danial Kosarifa
  • 1,044
  • 4
  • 18
  • 51

2 Answers2

2

You forgot to set DQL statement to query object.
add aclDetailsFetching.setDQL(fetchAclsInfoQuery);

Sergi
  • 990
  • 5
  • 16
0

Try writing

String fetchAclsInfoQuery = "select owner_name from dm_acl where description = '@aclname0' or description = '@aclname1' or description = '@aclname2' enable (ROW_BASED) ";

instead of

String fetchAclsInfoQuery = "select * from dm_acl where description = '@aclname0' or description = '@aclname1' or description = '@aclname2' enable (ROW_BASED) ";

I'm quite sure there is a problem with asterisk instead of real property name. You can use method hasAttr("<attribute_name>") to check wether your desired property (attribute) is loaded in collection.

Miki
  • 2,493
  • 2
  • 27
  • 39
  • They both work well . Just out of curiosity why would you think I need to specify the column names ? ;) – Danial Kosarifa Sep 22 '16 at 06:06
  • Because with asterisk you are not specifying property, it may happen that he doesn't put everything in your collection in VM. – Miki Sep 22 '16 at 07:12