You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by alarcher <an...@gmail.com> on 2008/12/22 11:48:33 UTC

OCM QueryManager - Results objects

Hi,

I'm using OCM QueryManager in a node structure like this :

* Parent1
   - Property1
   - Property2
   * Property3 (it's a @Bean field)
      - Property11
      - Property12

I wonder if there's a way to retrieve "Parent1" object while filtering on
Property11 of the Bean Property3 ?

What I do is :

        org.apache.jackrabbit.ocm.query.QueryManager mgr =
ocm.getQueryManager();
    	Filter filter = mgr.createFilter(Property3.class); 
    	filter.addLike("Property11", "...");
    	
    	org.apache.jackrabbit.ocm.query.Query query = mgr.createQuery(filter);
    	Collection results = ocm.getObjects(query);

Inevitably, the results are of type "Property3".

Do you know if there is a way that ocm.getObjects returns parent objects ?


Thanks very much,

Regards,

Antoine Larcher 
-- 
View this message in context: http://www.nabble.com/OCM-QueryManager---Results-objects-tp21125828p21125828.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: OCM QueryManager - Results objects

Posted by alarcher <an...@gmail.com>.
Thanks a lot Todd.

AL

Todd Seiber wrote:
> 
> Add a bean to the Property3 class to hold the parent object. Now create an
> object which extends AbstractBeanConverterImpl. In the getObject method
> get
> the parent (i.e. parentNode.getParent()). In your OCM definition map this
> bean object using converter="x.y.z.YourAbstractBeanConverterImpl"
> 
> On Mon, Dec 22, 2008 at 5:48 AM, alarcher <an...@gmail.com>
> wrote:
> 
>>
>> Hi,
>>
>> I'm using OCM QueryManager in a node structure like this :
>>
>> * Parent1
>>   - Property1
>>   - Property2
>>   * Property3 (it's a @Bean field)
>>      - Property11
>>      - Property12
>>
>> I wonder if there's a way to retrieve "Parent1" object while filtering on
>> Property11 of the Bean Property3 ?
>>
>> What I do is :
>>
>>        org.apache.jackrabbit.ocm.query.QueryManager mgr =
>> ocm.getQueryManager();
>>        Filter filter = mgr.createFilter(Property3.class);
>>        filter.addLike("Property11", "...");
>>
>>        org.apache.jackrabbit.ocm.query.Query query =
>> mgr.createQuery(filter);
>>        Collection results = ocm.getObjects(query);
>>
>> Inevitably, the results are of type "Property3".
>>
>> Do you know if there is a way that ocm.getObjects returns parent objects
>> ?
>>
>>
>> Thanks very much,
>>
>> Regards,
>>
>> Antoine Larcher
>> --
>> View this message in context:
>> http://www.nabble.com/OCM-QueryManager---Results-objects-tp21125828p21125828.html
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Todd Seiber
> 830 Fishing Creek Rd.
> New Cumberland, PA 17070
> 
> h. 717-938-5778
> c. 717-497-1742
> e. todd.seiber@gmail.com
> 
> 

-- 
View this message in context: http://www.nabble.com/OCM-QueryManager---Results-objects-tp21125828p21127990.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: OCM QueryManager - Results objects

Posted by Todd Seiber <to...@gmail.com>.
Add a bean to the Property3 class to hold the parent object. Now create an
object which extends AbstractBeanConverterImpl. In the getObject method get
the parent (i.e. parentNode.getParent()). In your OCM definition map this
bean object using converter="x.y.z.YourAbstractBeanConverterImpl"

On Mon, Dec 22, 2008 at 5:48 AM, alarcher <an...@gmail.com> wrote:

>
> Hi,
>
> I'm using OCM QueryManager in a node structure like this :
>
> * Parent1
>   - Property1
>   - Property2
>   * Property3 (it's a @Bean field)
>      - Property11
>      - Property12
>
> I wonder if there's a way to retrieve "Parent1" object while filtering on
> Property11 of the Bean Property3 ?
>
> What I do is :
>
>        org.apache.jackrabbit.ocm.query.QueryManager mgr =
> ocm.getQueryManager();
>        Filter filter = mgr.createFilter(Property3.class);
>        filter.addLike("Property11", "...");
>
>        org.apache.jackrabbit.ocm.query.Query query =
> mgr.createQuery(filter);
>        Collection results = ocm.getObjects(query);
>
> Inevitably, the results are of type "Property3".
>
> Do you know if there is a way that ocm.getObjects returns parent objects ?
>
>
> Thanks very much,
>
> Regards,
>
> Antoine Larcher
> --
> View this message in context:
> http://www.nabble.com/OCM-QueryManager---Results-objects-tp21125828p21125828.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>


-- 
Todd Seiber
830 Fishing Creek Rd.
New Cumberland, PA 17070

h. 717-938-5778
c. 717-497-1742
e. todd.seiber@gmail.com