Strange behaviour after IDfQuery.execute

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

  • edited March 16, 2012

    Try:

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

  • edited March 16, 2012

    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

  • edited March 16, 2012

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

  • edited March 16, 2012
    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] [email protected]<init>("SELECT DISTINCT object_name FROM dm_docbase_config") ==> <void>
    <dmadmin|s30(30.547)|[email protected]> [Update ACL 3] [email protected]([email protected]7,0) ==> [email protected]
    <dmadmin|s30(30.547)|[email protected]> [Update ACL 3] [email protected]1.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.

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

    Yep, the query returns results ...

  • edited March 16, 2012
    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.

  • edited March 16, 2012

    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.

  • edited March 16, 2012
    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.

  • edited March 19, 2012

    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?

  • edited March 19, 2012

    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.

Sign In or Register to comment.