Strange behaviour after IDfQuery.execute

Jeremy Saumen
edited March 19, 2012 in Documentum #1

Hi everyone,

I'm experiencing sometimes a really strange behaviour after executing a dql thanks to IDfQuery.execute : the collection returned does not contain anything even if the query has to always return something (for example a "count" query). Have you ever experimented such a behaviour ?

Here is my code (hard to make it simplier) :

String dql = "SELECT COUNT(*) AS cpt FROM dm_dbo.myview WHERE project_id = 132861";IDfQuery dfQuery = new DfQuery(dql);IDfCollection coll = null;try {     coll = dfQuery.execute(dfTypedObject.getObjectSession(), IDfQuery.DF_READ_QUERY);     if (coll.next()) {          result = coll.getString("cpt");     } else {          throw new DfException("Scalar Query has not return any result : " + dql);     }} finally {     if (coll != null) {          coll.close();     }}

It's the first time i'm trying to work with threads, I know of the limitation of 10 collections per session but i'm using a different session for each thread so i don't think that's that ... Is there something else i should know ?

I'm using DFC 6.7sp1.

Comments

  • Francois Dauberlieu
    edited March 16, 2012 #2

    Try:

    result = coll.getTypedObject().getString("cpt");

  • kcrkarthik
    edited March 16, 2012 #3

    Looks like you are reading values from "myview" which is external to the repository. Create a similar code but only using JDBC and NO dfc; check if you are encountering the issue.

    If not, try using DF_EXECREAD_QUERY

    -karthik

  • DCTM_Guru
    edited March 16, 2012 #4

    Have you verified that the query returns something in Documentum Administrator?

  • Jeremy Saumen
    edited March 16, 2012 #5
    Karthik Chokkaraman a écrit:Looks like you are reading values from "myview" which is external to the repository. Create a similar code but only using JDBC and NO dfc; check if you are encountering the issue.If not, try using DF_EXECREAD_QUERY-karthik

    Hi,

    "dm_dbo.myview" is an example, sometimes it's a standard dql query which fails.

    N/A                               [Update ACL 3] com.documentum.fc.client.DfQuery@c6af24.<init>("SELECT DISTINCT object_name FROM dm_docbase_config") ==> <void>
    <dmadmin|s30(30.547)|SM@33175995> [Update ACL 3] com.documentum.fc.client.DfQuery@c6af24.execute(com.documentum.fc.client.impl.session.StrongSessionHandle@1769f17,0) ==> com.documentum.fc.client.IDfCollection@18ebb11
    <dmadmin|s30(30.547)|SM@33175995> [Update ACL 3] com.documentum.fc.client.impl.collection.CollectionHandle@18ebb11.next() ==> false

    As you can see, i'm using the installation owner to launch my script so there is no way this query won't return any result ...

    I tried with DF_EXECREAD_QUERY also and no luck.

    The only way, i was able to execute my script is to not use threads. I must do something wrong but can't figure that out.

  • Jeremy Saumen
    edited March 16, 2012 #6
    Johnny Gee a écrit:Have you verified that the query returns something in Documentum Administrator?

    Yep, the query returns results ...

  • Jeremy Saumen
    edited March 16, 2012 #7
    Francois Dauberlieu a écrit:Try:result = coll.getTypedObject().getString("cpt");

    It's not the value which is returned, it's the call to "next" method which returns false.

  • bacham2
    edited March 16, 2012 #8

    Perhaps the session you are using (dfTypedObject.getObjectSession()) has already been released. Or perhaps it is released only in certain circumstances. In any case, something must be wrong in your session handling.

  • Jeremy Saumen
    edited March 16, 2012 #9
    bacham2 a écrit:Perhaps the session you are using (dfTypedObject.getObjectSession()) has already been released. Or perhaps it is released only in certain circumstances. In any case, something must be wrong in your session handling.

    In fact, i'm lauching the query from a method from a custom SBO which takes an IDfSysObject as a parameter and the query is generated dynamicaly thanks to some attributes recovered from that IDfSysObject (the IdfTypedObject), so i don't think that the session is closed. But to be sure, since yesterday, i tried not to recover the session from the IDfSysObject but from the method IDfService.getSession() and there is no difference.

  • bacham2
    edited March 19, 2012 #10

    Using IDfService.getSession is definitely the way to go. There still must be a session handling issue in your code though. Can you post your code that instantiates the SBO and instantiates the sessions?

    You mentioned threads in the beginning: does your code always work when you only have a single thread?

  • rajeshshivekar
    edited March 19, 2012 #11

    Here is my 2 cents,

    You said you get the result using the DQL from DA, right?

    What user credentials you use to login to DA? System Administrator?

    And also let us know you query code is executed with which user? (what permissions that user has).

    Also post your code here

  • @Jeremy_LU did you manage to solve it? I'm facing similar issue with DFC 7.3 and also 16.4 where the DQL is executed in a Job under JMS, where the job creates another threads and the DQL is executed from those threads.

    It happens only sometimes and only under JMS, outside JMS it is not possible to simulate that situation.

  • @cgrim_cz said:
    @Jeremy_LU did you manage to solve it? I'm facing similar issue with DFC 7.3 and also 16.4 where the DQL is executed in a Job under JMS, where the job creates another threads and the DQL is executed from those threads.

    It happens only sometimes and only under JMS, outside JMS it is not possible to simulate that situation.

    Sorry, I never found what was causing the problem and finally I didn't use threads

  • OK, no problem. Finally, I solved it by using SQL instead of DQL, which has the added benefit - it is faster.