You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Kurz Wolfgang <wo...@gwvs.de> on 2009/01/26 10:30:50 UTC

OCM Search problem

Hi everyone,

I am useing OCM to store things in Jackrabbit.

I have a problem building my filter:

My Class is called JCR Content and looks something like this:

@Node
public class JCRContent implements Serializable {


	/**
	 * Reference to the unique ContentId
	 */
	@Field(uuid=true)
	private String uuid;

	/**
	 * Reference to the Kategories/MenuIds of a Content object
	 */
	@Collection(elementClassName = MenuId.class)
	private List<MenuId> menuIds;
	
	/**
	 * Path of the Content Entry in Jackrabbit
	 */
	@Field(path=true)
	private String path;
}

Now my problems is that I only want objects with a certain menuId returned.

I tried this but it wont work :

ObjectContentManager ocm = ocmFactory.createObjectContentManager();		
			
org.apache.jackrabbit.ocm.query.QueryManager queryManager = ocm.getQueryManager();		
			
Filter filter = queryManager.createFilter(JCRContent.class);	
			
filter.addEqualTo("menuid", "1067");

Can anyone please give me ahint on how I would do this query?

Thx a lot in advance!



Re: OCM Search problem

Posted by Todd Seiber <to...@gmail.com>.
OCM will make all Objects annotated with @Node into nt:unstructured node
types unless you specify a value for the jcrType property. The default value
for discriminator should be true so I would have thought that it could map
back to your JCRContent object.

Personally I have found it much easier to work with XML configuration files
for OCM instead of annotations. You will probably find it easier to handle
all your mapping in one file and it saves recompiles for small changes that
you may have for deployed applications.

On Mon, Jan 26, 2009 at 8:56 AM, Kurz Wolfgang <wo...@gwvs.de>wrote:

> Oh i forgot to post the error i get using XPath with ocm:
>
> org.apache.jackrabbit.ocm.exception.IncorrectPersistentClassException: Node
> type: nt:unstructured has no descriptor.
>    at
>
> org.apache.jackrabbit.ocm.mapper.impl.AbstractMapperImpl.getClassDescriptorByNodeType(AbstractMapperImpl.java:188)
>    at
>
> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.getObject(ObjectConverterImpl.java:293)
>    at
>
> org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.getObjects(ObjectContentManagerImpl.java:622)
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Kurz Wolfgang [mailto:wolfgang.kurz@gwvs.de]
> Gesendet: Montag, 26. Januar 2009 14:12
> An: users@jackrabbit.apache.org
> Betreff: AW: OCM Search problem
>
> Thats what i thought too.
>
> This is the Query I came up with:
>
> //*[(@" + PROP_MENUID + "= '" + menuId + "')]/parent::*
>
> But since ocm is done with xPath in the background too I thought I could
> somehow get this query with ocm too.
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Todd Seiber [mailto:todd.seiber@gmail.com]
> Gesendet: Montag, 26. Januar 2009 14:03
> An: users@jackrabbit.apache.org
> Betreff: Re: OCM Search problem
>
> I believe that your only choice will be to use XPATH. The filter would be
> for properties but your menuIds are being stored as nodes.
>
>
> On Mon, Jan 26, 2009 at 4:30 AM, Kurz Wolfgang <wolfgang.kurz@gwvs.de
> >wrote:
>
> > Hi everyone,
> >
> > I am useing OCM to store things in Jackrabbit.
> >
> > I have a problem building my filter:
> >
> > My Class is called JCR Content and looks something like this:
> >
> > @Node
> > public class JCRContent implements Serializable {
> >
> >
> >        /**
> >         * Reference to the unique ContentId
> >         */
> >        @Field(uuid=true)
> >        private String uuid;
> >
> >        /**
> >         * Reference to the Kategories/MenuIds of a Content object
> >         */
> >        @Collection(elementClassName = MenuId.class)
> >        private List<MenuId> menuIds;
> >
> >        /**
> >         * Path of the Content Entry in Jackrabbit
> >         */
> >        @Field(path=true)
> >        private String path;
> > }
> >
> > Now my problems is that I only want objects with a certain menuId
> returned.
> >
> > I tried this but it wont work :
> >
> > ObjectContentManager ocm = ocmFactory.createObjectContentManager();
> >
> > org.apache.jackrabbit.ocm.query.QueryManager queryManager =
> > ocm.getQueryManager();
> >
> > Filter filter = queryManager.createFilter(JCRContent.class);
> >
> > filter.addEqualTo("menuid", "1067");
> >
> > Can anyone please give me ahint on how I would do this query?
> >
> > Thx a lot in advance!
> >
> >
> >
>
>
> --
> Todd Seiber
> 830 Fishing Creek Rd.
> New Cumberland, PA 17070
>
> h. 717-938-5778
> c. 717-497-1742
> e. todd.seiber@gmail.com
>



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

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

AW: OCM Search problem

Posted by Kurz Wolfgang <wo...@gwvs.de>.
Oh i forgot to post the error i get using XPath with ocm:

org.apache.jackrabbit.ocm.exception.IncorrectPersistentClassException: Node 
type: nt:unstructured has no descriptor.
    at 
org.apache.jackrabbit.ocm.mapper.impl.AbstractMapperImpl.getClassDescriptorByNodeType(AbstractMapperImpl.java:188)
    at 
org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl.getObject(ObjectConverterImpl.java:293)
    at 
org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.getObjects(ObjectContentManagerImpl.java:622)



-----Ursprüngliche Nachricht-----
Von: Kurz Wolfgang [mailto:wolfgang.kurz@gwvs.de] 
Gesendet: Montag, 26. Januar 2009 14:12
An: users@jackrabbit.apache.org
Betreff: AW: OCM Search problem

Thats what i thought too.

This is the Query I came up with:

//*[(@" + PROP_MENUID + "= '" + menuId + "')]/parent::*

But since ocm is done with xPath in the background too I thought I could somehow get this query with ocm too.



-----Ursprüngliche Nachricht-----
Von: Todd Seiber [mailto:todd.seiber@gmail.com] 
Gesendet: Montag, 26. Januar 2009 14:03
An: users@jackrabbit.apache.org
Betreff: Re: OCM Search problem

I believe that your only choice will be to use XPATH. The filter would be
for properties but your menuIds are being stored as nodes.


On Mon, Jan 26, 2009 at 4:30 AM, Kurz Wolfgang <wo...@gwvs.de>wrote:

> Hi everyone,
>
> I am useing OCM to store things in Jackrabbit.
>
> I have a problem building my filter:
>
> My Class is called JCR Content and looks something like this:
>
> @Node
> public class JCRContent implements Serializable {
>
>
>        /**
>         * Reference to the unique ContentId
>         */
>        @Field(uuid=true)
>        private String uuid;
>
>        /**
>         * Reference to the Kategories/MenuIds of a Content object
>         */
>        @Collection(elementClassName = MenuId.class)
>        private List<MenuId> menuIds;
>
>        /**
>         * Path of the Content Entry in Jackrabbit
>         */
>        @Field(path=true)
>        private String path;
> }
>
> Now my problems is that I only want objects with a certain menuId returned.
>
> I tried this but it wont work :
>
> ObjectContentManager ocm = ocmFactory.createObjectContentManager();
>
> org.apache.jackrabbit.ocm.query.QueryManager queryManager =
> ocm.getQueryManager();
>
> Filter filter = queryManager.createFilter(JCRContent.class);
>
> filter.addEqualTo("menuid", "1067");
>
> Can anyone please give me ahint on how I would do this query?
>
> Thx a lot in advance!
>
>
>


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

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

AW: OCM Search problem

Posted by Kurz Wolfgang <wo...@gwvs.de>.
Thats what i thought too.

This is the Query I came up with:

//*[(@" + PROP_MENUID + "= '" + menuId + "')]/parent::*

But since ocm is done with xPath in the background too I thought I could somehow get this query with ocm too.



-----Ursprüngliche Nachricht-----
Von: Todd Seiber [mailto:todd.seiber@gmail.com] 
Gesendet: Montag, 26. Januar 2009 14:03
An: users@jackrabbit.apache.org
Betreff: Re: OCM Search problem

I believe that your only choice will be to use XPATH. The filter would be
for properties but your menuIds are being stored as nodes.


On Mon, Jan 26, 2009 at 4:30 AM, Kurz Wolfgang <wo...@gwvs.de>wrote:

> Hi everyone,
>
> I am useing OCM to store things in Jackrabbit.
>
> I have a problem building my filter:
>
> My Class is called JCR Content and looks something like this:
>
> @Node
> public class JCRContent implements Serializable {
>
>
>        /**
>         * Reference to the unique ContentId
>         */
>        @Field(uuid=true)
>        private String uuid;
>
>        /**
>         * Reference to the Kategories/MenuIds of a Content object
>         */
>        @Collection(elementClassName = MenuId.class)
>        private List<MenuId> menuIds;
>
>        /**
>         * Path of the Content Entry in Jackrabbit
>         */
>        @Field(path=true)
>        private String path;
> }
>
> Now my problems is that I only want objects with a certain menuId returned.
>
> I tried this but it wont work :
>
> ObjectContentManager ocm = ocmFactory.createObjectContentManager();
>
> org.apache.jackrabbit.ocm.query.QueryManager queryManager =
> ocm.getQueryManager();
>
> Filter filter = queryManager.createFilter(JCRContent.class);
>
> filter.addEqualTo("menuid", "1067");
>
> Can anyone please give me ahint on how I would do this query?
>
> Thx a lot in advance!
>
>
>


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

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

Re: OCM Search problem

Posted by Todd Seiber <to...@gmail.com>.
I believe that your only choice will be to use XPATH. The filter would be
for properties but your menuIds are being stored as nodes.


On Mon, Jan 26, 2009 at 4:30 AM, Kurz Wolfgang <wo...@gwvs.de>wrote:

> Hi everyone,
>
> I am useing OCM to store things in Jackrabbit.
>
> I have a problem building my filter:
>
> My Class is called JCR Content and looks something like this:
>
> @Node
> public class JCRContent implements Serializable {
>
>
>        /**
>         * Reference to the unique ContentId
>         */
>        @Field(uuid=true)
>        private String uuid;
>
>        /**
>         * Reference to the Kategories/MenuIds of a Content object
>         */
>        @Collection(elementClassName = MenuId.class)
>        private List<MenuId> menuIds;
>
>        /**
>         * Path of the Content Entry in Jackrabbit
>         */
>        @Field(path=true)
>        private String path;
> }
>
> Now my problems is that I only want objects with a certain menuId returned.
>
> I tried this but it wont work :
>
> ObjectContentManager ocm = ocmFactory.createObjectContentManager();
>
> org.apache.jackrabbit.ocm.query.QueryManager queryManager =
> ocm.getQueryManager();
>
> Filter filter = queryManager.createFilter(JCRContent.class);
>
> filter.addEqualTo("menuid", "1067");
>
> Can anyone please give me ahint on how I would do this query?
>
> Thx a lot in advance!
>
>
>


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

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