You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Charles N. Harvey III" <ch...@alloy.com> on 2004/06/09 21:27:30 UTC

null report query

Hello.
I am creating a ReportQueryByCriteria and it is turning up null.
And I don't even understand how that can happen.

Criteria criteria = new Criteria();
ReportQueryByCriteria subQuery = QueryFactory.newReportQuery( 
MyObject.class, criteria );
System.out.println( "\tReportQueryByCriteria: " + subQuery.toString() );

subQuery is null.  I am only trying to print it to see what it is doing
and I can't do that.  Is it because my criteria is empty?  That 
shouldn't do it.
Does it not like the MyObject?

Has anyone else had this happen before?

Thanks a lot.


Charlie


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: incorrect fk-pointing-to-element-class value when using recursive collections and doclet

Posted by Thomas Dudziak <to...@first.gmd.de>.
Is fixed in CVS. Please note that I also updated to XDoclet 1.2.1 though
there were no API changes that affected the OJB XDoclet module, so it
should still work with XDoclet 1.2.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: incorrect fk-pointing-to-element-class value when using recursive collections and doclet

Posted by Thomas Dudziak <to...@first.gmd.de>.
On Thu, 10 Jun 2004, Bradford Pielech wrote:

> Tom:
> 
>          Thanks for the answer, but I am still confused-  when you say to 
> specify the inverse foreign key, do you mean to use the remote-foreignkey 
> attribute?

Yup, that's the one. Sorry for the confusion, in the repository it's
called inverse foreignkey (but I prefer remote foreignkey for the tags
because that's IMO easier to understand).

> This doesn't make sense to me because the parent and children 
> collection is explict and I get this error:
> 
> --------
> [ojbdoclet] Caused by: xdoclet.XDocletException: The remote-foreignkey 
> property specified for collection children in class 
> com.alphatech.ebo.datamodels.SimpleDAGNode
> doesn't match the foreignkey property of the corresponding collection 
> children in class com.alphatech.ebo.datamodels.SimpleDAGNode
> --------

Now this is a slightly different error caused by the same thing: the
XDoclet module will (currently) simply take the first collection in the
element class that it finds. After I fixed that, your changed Java code
will work (I'll have a look at it today).

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: deleteByQuery does not cascade deletes

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi bradford,

delete by query is using pure sql and works 'outside' ojb.
ojb does not know which objects are deleted, that's why you have to clear the 
cache manually afterwards.

hth
jakob

Bradford Pielech wrote:

> Hello again:
> 
>     I am writing some JUnit tests now and as part of the setup, I want 
> to make sure the DB is empty, so I wrote a method to delete all relevant 
> objects and their related objects:
> 
> ----------------
> public boolean deleteAllObjects(String classNameOfObject) {
>     boolean returnValue = true;
>     Class exampleClass = Class.forName(classNameOfObject);
>     Query query = QueryFactory.newQuery(exampleClass,
>                                         
> QueryByCriteria.CRITERIA_SELECT_ALL);
>     PersistenceBroker pbroker = PersistenceBrokerFactory.
>         defaultPersistenceBroker();
>       pbroker.beginTransaction();
>       pbroker.deleteByQuery(query);
>       pbroker.commitTransaction();
> }
> -------------------
> 
> However, when I run this, only the objects from the Primary class are 
> deleted (see below) and not any associated ReferencedObjects.  This was 
> confirmed by looking at the p6spy logI changed the code to deleteAll by 
> first retrieving all objects of the type and then calling delete on each:
> 
> ----------
> public boolean deleteAllObjects(String classNameOfObject) {
>        PersistenceBroker pbroker = 
> PersistenceBrokerFactory.defaultPersistenceBroker();
>     try {
>       List objects = getObjectsOfType(classNameOfObject);      //uses 
> getCollectionByQuery and CRITERIA_SELECT_ALL
>       pbroker.beginTransaction();
>       for (Iterator i = objects.iterator(); i.hasNext(); ) {
>         pbroker.delete(i.next());
>       }
>       pbroker.deleteByQuery(query);
>       pbroker.commitTransaction();
> ------------
> 
> And this version successfully deleted all objects and their associations 
> (again confirmed by p6spy).  Now I know the mapping file is correct, 
> otherwise the 2nd version would have failed.  I included relevant 
> sections of it below, just in case.
> 
> Any ideas what I am doing wrong?
> 
> thanks,
> Brad
> 
> --------------------
> <class-descriptor
>     class="PrimaryClass"
>     table="table1"
>  >
> <reference-descriptor
>         name="tasks"
>         class-ref="ReferencedClass"
>         refresh="true"
>         auto-retrieve="true"
>         auto-update="true"
>         auto-delete="object"
>     >
>         <foreignkey field-ref="fk_id"/>
> <field-descriptor
>         name="fk_id"
>         column="fk_id"
>         jdbc-type="VARCHAR"
>         length="35"
>     >
> </class-descriptor>
> 
> <class-descriptor
>     class="ReferencedClass"
>     table="table2"
>  >
>     <field-descriptor
>         name="ID"
>         column="pk_id"
>         jdbc-type="VARCHAR"
>         primarykey="true"
>         length="35"
>     >
> </class-descriptor>
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


deleteByQuery does not cascade deletes

Posted by Bradford Pielech <br...@alphatech.com>.
Hello again:

	I am writing some JUnit tests now and as part of the setup, I want to make 
sure the DB is empty, so I wrote a method to delete all relevant objects 
and their related objects:

----------------
public boolean deleteAllObjects(String classNameOfObject) {
     boolean returnValue = true;
     Class exampleClass = Class.forName(classNameOfObject);
     Query query = QueryFactory.newQuery(exampleClass,
                                         QueryByCriteria.CRITERIA_SELECT_ALL);
     PersistenceBroker pbroker = PersistenceBrokerFactory.
         defaultPersistenceBroker();
       pbroker.beginTransaction();
       pbroker.deleteByQuery(query);
       pbroker.commitTransaction();
}
-------------------

However, when I run this, only the objects from the Primary class are 
deleted (see below) and not any associated ReferencedObjects.  This was 
confirmed by looking at the p6spy logI changed the code to deleteAll by 
first retrieving all objects of the type and then calling delete on each:

----------
public boolean deleteAllObjects(String classNameOfObject) {
        PersistenceBroker pbroker = 
PersistenceBrokerFactory.defaultPersistenceBroker();
     try {
       List objects = getObjectsOfType(classNameOfObject);      //uses 
getCollectionByQuery and CRITERIA_SELECT_ALL
       pbroker.beginTransaction();
       for (Iterator i = objects.iterator(); i.hasNext(); ) {
         pbroker.delete(i.next());
       }
       pbroker.deleteByQuery(query);
       pbroker.commitTransaction();
------------

And this version successfully deleted all objects and their associations 
(again confirmed by p6spy).  Now I know the mapping file is correct, 
otherwise the 2nd version would have failed.  I included relevant sections 
of it below, just in case.

Any ideas what I am doing wrong?

thanks,
Brad

--------------------
<class-descriptor
     class="PrimaryClass"
     table="table1"
 >
<reference-descriptor
         name="tasks"
         class-ref="ReferencedClass"
         refresh="true"
         auto-retrieve="true"
         auto-update="true"
         auto-delete="object"
     >
         <foreignkey field-ref="fk_id"/>
<field-descriptor
         name="fk_id"
         column="fk_id"
         jdbc-type="VARCHAR"
         length="35"
     >
</class-descriptor>

<class-descriptor
     class="ReferencedClass"
     table="table2"
 >
     <field-descriptor
         name="ID"
         column="pk_id"
         jdbc-type="VARCHAR"
         primarykey="true"
         length="35"
     >
</class-descriptor>





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: incorrect fk-pointing-to-element-class value when using recursive collections and doclet

Posted by Bradford Pielech <br...@alphatech.com>.
Tom:

         Thanks for the answer, but I am still confused-  when you say to 
specify the inverse foreign key, do you mean to use the remote-foreignkey 
attribute?  This doesn't make sense to me because the parent and children 
collection is explict and I get this error:

--------
[ojbdoclet] Caused by: xdoclet.XDocletException: The remote-foreignkey 
property specified for collection children in class 
com.alphatech.ebo.datamodels.SimpleDAGNode
doesn't match the foreignkey property of the corresponding collection 
children in class com.alphatech.ebo.datamodels.SimpleDAGNode
--------

Here is my java code:

-------------------------
public class SimpleDAGNode{

   /**
    * @ojb.collection 
element-class-ref="com.alphatech.ebo.datamodels.SimpleDAGNode"
    *                 auto-retrieve="true"
    *                 auto-update="true"
    *                 auto-delete="true"
    *                 indirection-table="parent_children_table"
    *                 foreignkey="parent_id"
    *                 remote-foreignkey="child_id"
    *
    */
   protected List children;

   /**
    * @ojb.field primarykey="true"
    * column="ebo_id"
    * jdbc-type="VARCHAR"
    * length="35"
    */
   protected String ID;

   /**
        * @ojb.collection 
element-class-ref="com.alphatech.ebo.datamodels.SimpleDAGNode"
    *                 auto-retrieve="true"
    *                 auto-update="true"
    *                 auto-delete="true"
    *                 indirection-table="parent_children_table"
    *                 foreignkey="child_id"
    *                 remote-foreignkey="parent_id"
    *
    */
   protected List parents;
-------------------------

thanks,
Brad

Well, its not exactly a bug. Since you didn't specify an inverse foreign
>key, the XDoclet module will use the foreignkey of the first collection in
>the element class that specifies the same indirection table. Only it
>currently won't check whether thats the same collection (which I'll fix).
>
>However I think in your case you should specify the inverse foreignkey
>anyway. If (for whatever reason) you decide to add a third collection
>right that points to the same class (e.g. neighbors) at the beginning of
>the class then you will get the same problem again.
>
>Tom
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: incorrect fk-pointing-to-element-class value when using recursive collections and doclet

Posted by Thomas Dudziak <to...@first.gmd.de>.
On Wed, 9 Jun 2004, Bradford Pielech wrote:

> Hello:
> 
> 	I have a class that acts like a standard DAG node, i.e. it has multiple 
> parents and children that are each DAG nodes.  I am using the Xdoclet 
> module to create the repository file and torque to create SQL and 
> database.  I am representing the parent and children relationships using an 
> indirection table.  My problem is this- the XDoclet module incorrectly 
> generates the fk-pointing-to-element-class value.  Below is the generated 
> mapping file and corresponding java source.  Notice that the
>   fk-pointing-to-element-class element for the children collection should 
> have a value of "child_id".
> If I manually change this value, then the mapping and sql are correct, and 
> my program behaves as I expect.
> 
> Mapping snippet:
> ----------------------------
> <class-descriptor
>      class="SimpleDAGNode"
>      table="effect"
>  >
>      <field-descriptor
>          name="ID"
>          column="ebo_id"
>          jdbc-type="VARCHAR"
>          primarykey="true"
>          length="35"
>      >
>      </field-descriptor>
>      <collection-descriptor
>          name="children"
>          element-class-ref="SimpleDAGNode"
>          indirection-table="parent_children_table"
>          auto-retrieve="true"
>          auto-update="true"
>          auto-delete="true"
>      >
>          <fk-pointing-to-this-class column="parent_id"/>
>          <fk-pointing-to-element-class column="parent_id"/>
>      </collection-descriptor>
> 
>      <collection-descriptor
>          name="parents"
>          element-class-ref="SimpleDAGNode"
>          indirection-table="parent_children_table"
>          auto-retrieve="true"
>          auto-update="true"
>          auto-delete="true"
>      >
>          <fk-pointing-to-this-class column="child_id"/>
>          <fk-pointing-to-element-class column="parent_id"/>
>      </collection-descriptor>
> </class-descriptor>
> --------------------
> 
> Java source:
> -----------------------------
> public class SimpleDAGNode     {
> 
>    /**
>     * @ojb.collection 
> element-class-ref="com.alphatech.ebo.datamodels.SimpleDAGNode"
>     *                 auto-retrieve="true"
>     *                 auto-update="true"
>     *                 auto-delete="true"
>     *                 indirection-table="parent_children_table"
>     *                 foreignkey="parent_id"
>     */
>    protected List children;
> 
>    /**
>     * @ojb.field primarykey="true"
>     * column="ebo_id"
>     * jdbc-type="VARCHAR"
>     * length="35"
>     */
>    protected String ID;
> 
>    /**
>         * @ojb.collection 
> element-class-ref="com.alphatech.ebo.datamodels.SimpleDAGNode"
>     *                 auto-retrieve="true"
>     *                 auto-update="true"
>     *                 auto-delete="true"
>     *                 indirection-table="parent_children_table"
>     *                 foreignkey="child_id"
>     */
>    protected List parents;
> ------------------------------------
> 
> If I switch the order that parents and children are declared in the java 
> file, the problem happens with parents, not children.  Thus, it appears 
> something is amiss in the XDoclet.

Well, its not exactly a bug. Since you didn't specify an inverse foreign
key, the XDoclet module will use the foreignkey of the first collection in
the element class that specifies the same indirection table. Only it
currently won't check whether thats the same collection (which I'll fix).

However I think in your case you should specify the inverse foreignkey
anyway. If (for whatever reason) you decide to add a third collection
right that points to the same class (e.g. neighbors) at the beginning of
the class then you will get the same problem again.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: incorrect fk-pointing-to-element-class value when using recursive collections and doclet

Posted by Thomas Dudziak <to...@first.fraunhofer.de>.
On Wed, 9 Jun 2004, Bradford Pielech wrote:

> Hello:
> 
> 	I have a class that acts like a standard DAG node, i.e. it has multiple 
> parents and children that are each DAG nodes.  I am using the Xdoclet 
> module to create the repository file and torque to create SQL and 
> database.  I am representing the parent and children relationships using an 
> indirection table.  My problem is this- the XDoclet module incorrectly 
> generates the fk-pointing-to-element-class value.  Below is the generated 
> mapping file and corresponding java source.  Notice that the
>   fk-pointing-to-element-class element for the children collection should 
> have a value of "child_id".
> If I manually change this value, then the mapping and sql are correct, and 
> my program behaves as I expect.
> 
> Mapping snippet:
> ----------------------------
> <class-descriptor
>      class="SimpleDAGNode"
>      table="effect"
>  >
>      <field-descriptor
>          name="ID"
>          column="ebo_id"
>          jdbc-type="VARCHAR"
>          primarykey="true"
>          length="35"
>      >
>      </field-descriptor>
>      <collection-descriptor
>          name="children"
>          element-class-ref="SimpleDAGNode"
>          indirection-table="parent_children_table"
>          auto-retrieve="true"
>          auto-update="true"
>          auto-delete="true"
>      >
>          <fk-pointing-to-this-class column="parent_id"/>
>          <fk-pointing-to-element-class column="parent_id"/>
>      </collection-descriptor>
> 
>      <collection-descriptor
>          name="parents"
>          element-class-ref="SimpleDAGNode"
>          indirection-table="parent_children_table"
>          auto-retrieve="true"
>          auto-update="true"
>          auto-delete="true"
>      >
>          <fk-pointing-to-this-class column="child_id"/>
>          <fk-pointing-to-element-class column="parent_id"/>
>      </collection-descriptor>
> </class-descriptor>
> --------------------
> 
> Java source:
> -----------------------------
> public class SimpleDAGNode     {
> 
>    /**
>     * @ojb.collection 
> element-class-ref="com.alphatech.ebo.datamodels.SimpleDAGNode"
>     *                 auto-retrieve="true"
>     *                 auto-update="true"
>     *                 auto-delete="true"
>     *                 indirection-table="parent_children_table"
>     *                 foreignkey="parent_id"
>     */
>    protected List children;
> 
>    /**
>     * @ojb.field primarykey="true"
>     * column="ebo_id"
>     * jdbc-type="VARCHAR"
>     * length="35"
>     */
>    protected String ID;
> 
>    /**
>         * @ojb.collection 
> element-class-ref="com.alphatech.ebo.datamodels.SimpleDAGNode"
>     *                 auto-retrieve="true"
>     *                 auto-update="true"
>     *                 auto-delete="true"
>     *                 indirection-table="parent_children_table"
>     *                 foreignkey="child_id"
>     */
>    protected List parents;
> ------------------------------------
> 
> If I switch the order that parents and children are declared in the java 
> file, the problem happens with parents, not children.  Thus, it appears 
> something is amiss in the XDoclet.

Well, its not exactly a bug. Since you didn't specify an inverse foreign
key, the XDoclet module will use the foreignkey of the first collection in
the element class that specifies the same indirection table. Only it
currently won't check whether thats the same collection (which I'll fix).

However I think in your case you should specify the inverse foreignkey
anyway. If (for whatever reason) you decide to add a third collection
right that points to the same class (e.g. neighbors) at the beginning of
the class then you will get the same problem again.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


incorrect fk-pointing-to-element-class value when using recursive collections and doclet

Posted by Bradford Pielech <br...@alphatech.com>.
Hello:

	I have a class that acts like a standard DAG node, i.e. it has multiple 
parents and children that are each DAG nodes.  I am using the Xdoclet 
module to create the repository file and torque to create SQL and 
database.  I am representing the parent and children relationships using an 
indirection table.  My problem is this- the XDoclet module incorrectly 
generates the fk-pointing-to-element-class value.  Below is the generated 
mapping file and corresponding java source.  Notice that the
  fk-pointing-to-element-class element for the children collection should 
have a value of "child_id".
If I manually change this value, then the mapping and sql are correct, and 
my program behaves as I expect.

Mapping snippet:
----------------------------
<class-descriptor
     class="SimpleDAGNode"
     table="effect"
 >
     <field-descriptor
         name="ID"
         column="ebo_id"
         jdbc-type="VARCHAR"
         primarykey="true"
         length="35"
     >
     </field-descriptor>
     <collection-descriptor
         name="children"
         element-class-ref="SimpleDAGNode"
         indirection-table="parent_children_table"
         auto-retrieve="true"
         auto-update="true"
         auto-delete="true"
     >
         <fk-pointing-to-this-class column="parent_id"/>
         <fk-pointing-to-element-class column="parent_id"/>
     </collection-descriptor>

     <collection-descriptor
         name="parents"
         element-class-ref="SimpleDAGNode"
         indirection-table="parent_children_table"
         auto-retrieve="true"
         auto-update="true"
         auto-delete="true"
     >
         <fk-pointing-to-this-class column="child_id"/>
         <fk-pointing-to-element-class column="parent_id"/>
     </collection-descriptor>
</class-descriptor>
--------------------

Java source:
-----------------------------
public class SimpleDAGNode     {

   /**
    * @ojb.collection 
element-class-ref="com.alphatech.ebo.datamodels.SimpleDAGNode"
    *                 auto-retrieve="true"
    *                 auto-update="true"
    *                 auto-delete="true"
    *                 indirection-table="parent_children_table"
    *                 foreignkey="parent_id"
    */
   protected List children;

   /**
    * @ojb.field primarykey="true"
    * column="ebo_id"
    * jdbc-type="VARCHAR"
    * length="35"
    */
   protected String ID;

   /**
        * @ojb.collection 
element-class-ref="com.alphatech.ebo.datamodels.SimpleDAGNode"
    *                 auto-retrieve="true"
    *                 auto-update="true"
    *                 auto-delete="true"
    *                 indirection-table="parent_children_table"
    *                 foreignkey="child_id"
    */
   protected List parents;
------------------------------------

If I switch the order that parents and children are declared in the java 
file, the problem happens with parents, not children.  Thus, it appears 
something is amiss in the XDoclet.

Thank you very much for your assistance,
Brad


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: null report query

Posted by "Charles N. Harvey III" <ch...@alloy.com>.
Jakob,
You were correct.  I hadn't done anything with my subQuery yet so 
toString() was
returning a null.  I was tracking a NPE and I was printing out after 
different lines
and that one threw an error so I started to think that was the problem.  
Its not.
Now I have to find the real NPE and then figure out why my query is not 
being
constructed the way I thought it would.

Thanks for putting in the patch though!


Charlie



Jakob Braeuchi said the following on 6/9/2004 4:01 PM:

> hi charles,
>
> i just commited a fix to ReportQuery and QueryByCriteria to prevent 
> NPE in toString()
>
> hth
> jakob
>
> Jakob Braeuchi wrote:
>
>> hi charles,
>>
>> are you sure that the subQuery is null ?
>> imo the npe is coming from the method toString() because there are no 
>> columns defined.
>>
>> jakob
>>
>> Charles N. Harvey III wrote:
>>
>>> Hello.
>>> I am creating a ReportQueryByCriteria and it is turning up null.
>>> And I don't even understand how that can happen.
>>>
>>> Criteria criteria = new Criteria();
>>> ReportQueryByCriteria subQuery = QueryFactory.newReportQuery( 
>>> MyObject.class, criteria );
>>> System.out.println( "\tReportQueryByCriteria: " + 
>>> subQuery.toString() );
>>>
>>> subQuery is null.  I am only trying to print it to see what it is doing
>>> and I can't do that.  Is it because my criteria is empty?  That 
>>> shouldn't do it.
>>> Does it not like the MyObject?
>>>
>>> Has anyone else had this happen before?
>>>
>>> Thanks a lot.
>>>
>>>
>>> Charlie
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: null report query

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi charles,

i just commited a fix to ReportQuery and QueryByCriteria to prevent NPE in 
toString()

hth
jakob

Jakob Braeuchi wrote:

> hi charles,
> 
> are you sure that the subQuery is null ?
> imo the npe is coming from the method toString() because there are no 
> columns defined.
> 
> jakob
> 
> Charles N. Harvey III wrote:
> 
>> Hello.
>> I am creating a ReportQueryByCriteria and it is turning up null.
>> And I don't even understand how that can happen.
>>
>> Criteria criteria = new Criteria();
>> ReportQueryByCriteria subQuery = QueryFactory.newReportQuery( 
>> MyObject.class, criteria );
>> System.out.println( "\tReportQueryByCriteria: " + subQuery.toString() );
>>
>> subQuery is null.  I am only trying to print it to see what it is doing
>> and I can't do that.  Is it because my criteria is empty?  That 
>> shouldn't do it.
>> Does it not like the MyObject?
>>
>> Has anyone else had this happen before?
>>
>> Thanks a lot.
>>
>>
>> Charlie
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: null report query

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi charles,

are you sure that the subQuery is null ?
imo the npe is coming from the method toString() because there are no columns 
defined.

jakob

Charles N. Harvey III wrote:

> Hello.
> I am creating a ReportQueryByCriteria and it is turning up null.
> And I don't even understand how that can happen.
> 
> Criteria criteria = new Criteria();
> ReportQueryByCriteria subQuery = QueryFactory.newReportQuery( 
> MyObject.class, criteria );
> System.out.println( "\tReportQueryByCriteria: " + subQuery.toString() );
> 
> subQuery is null.  I am only trying to print it to see what it is doing
> and I can't do that.  Is it because my criteria is empty?  That 
> shouldn't do it.
> Does it not like the MyObject?
> 
> Has anyone else had this happen before?
> 
> Thanks a lot.
> 
> 
> Charlie
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org