You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by danisevsky <da...@gmail.com> on 2009/11/12 09:38:46 UTC

JCR vs relational database + Hibernate

Hallo, I am thinking about learning and using Jackrabbit instead of (or
with) relational database (+ Hibernate) in my new web application. I would
like to store some data to JCR (on filesystem) and some data to database.
But question is for which kind of data si better JCR. My opinion is that
data like photos, blogs, comments is better storage JCR and data like users,
roles, classifiers is better database.
What do you think, is it right?
Thanks

Re: xpath

Posted by nch <un...@yahoo.com>.
  Sorry, I meant nt:file and nt:folder.
  I found I was swallowing an exception.

  Thanks!

--- El jue, 12/11/09, Alexander Klimetschek <ak...@day.com> escribió:

De: Alexander Klimetschek <ak...@day.com>
Asunto: Re: xpath
Para: users@jackrabbit.apache.org
Fecha: jueves, 12 de noviembre, 2009 19:25

On Thu, Nov 12, 2009 at 17:38, nch <un...@yahoo.com> wrote:
> I'm new to Jackrabbit and I'm having some problems to understand how xpath works here.
> If I have the following hierarchy:
> /test (jcr:folder)
> + file1.txt (jcr:file)
> + file2.txt (jcr:file)
>
> then I can retrieve all nodes in /test by means of the following xpath expression "/jcr:root/test/*"
>
> But, if I have the following:
> /test (jcr:directory)
>
> + file1.txt
>
> + file2.txt
>
> + newfolder (jcr:folder)
>
> then, the previous xpath expression does not yield any nodes.
> Any explanations for this?

It should be the same. Was there any error?

BTW: What are "jcr:directory", "jcr:file" and "jcr:folder" - custom
nodetypes? I suggest to use the standard nt:folder and nt:file.

BTW2: If you simply want to list child nodes at a given path, as your
xpath query does, I suggest to use JCR API navigation, rather then the
search. It will be simpler and faster. But of course this depends on
your application.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com



      

Re: xpath

Posted by Alexander Klimetschek <ak...@day.com>.
On Thu, Nov 12, 2009 at 17:38, nch <un...@yahoo.com> wrote:
> I'm new to Jackrabbit and I'm having some problems to understand how xpath works here.
> If I have the following hierarchy:
> /test (jcr:folder)
> + file1.txt (jcr:file)
> + file2.txt (jcr:file)
>
> then I can retrieve all nodes in /test by means of the following xpath expression "/jcr:root/test/*"
>
> But, if I have the following:
> /test (jcr:directory)
>
> + file1.txt
>
> + file2.txt
>
> + newfolder (jcr:folder)
>
> then, the previous xpath expression does not yield any nodes.
> Any explanations for this?

It should be the same. Was there any error?

BTW: What are "jcr:directory", "jcr:file" and "jcr:folder" - custom
nodetypes? I suggest to use the standard nt:folder and nt:file.

BTW2: If you simply want to list child nodes at a given path, as your
xpath query does, I suggest to use JCR API navigation, rather then the
search. It will be simpler and faster. But of course this depends on
your application.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: xpath

Posted by Rakesh Vidyadharan <ra...@sptci.com>.
On 12 Nov 2009, at 10:38:33 AM, nch wrote:

> Hi, there.
> 
> I'm new to Jackrabbit and I'm having some problems to understand how xpath works here.
> If I have the following hierarchy:
> /test (jcr:folder)
> + file1.txt (jcr:file)
> + file2.txt (jcr:file)
> 
> then I can retrieve all nodes in /test by means of the following xpath expression "/jcr:root/test/*"
> 
> But, if I have the following:
> /test (jcr:directory)
> 
> + file1.txt
> 
> + file2.txt
> 
> + newfolder (jcr:folder)
> 
> then, the previous xpath expression does not yield any nodes.
> Any explanations for this?

I forget if the default type for a query is nt:base or nt:unstructured.  If it is nt:unstructured, it will explain the issue with not finding the folder node.

Rakesh

xpath

Posted by nch <un...@yahoo.com>.
Hi, there.

I'm new to Jackrabbit and I'm having some problems to understand how xpath works here.
If I have the following hierarchy:
/test (jcr:folder)
+ file1.txt (jcr:file)
+ file2.txt (jcr:file)

then I can retrieve all nodes in /test by means of the following xpath expression "/jcr:root/test/*"

But, if I have the following:
/test (jcr:directory)

+ file1.txt

+ file2.txt

+ newfolder (jcr:folder)

then, the previous xpath expression does not yield any nodes.
Any explanations for this?

Kind regards.



      

Re: JCR vs relational database + Hibernate

Posted by Ian Boston <ie...@tfd.co.uk>.
On 12 Nov 2009, at 08:38, danisevsky wrote:

> Hallo, I am thinking about learning and using Jackrabbit instead of  
> (or
> with) relational database (+ Hibernate) in my new web application. I  
> would
> like to store some data to JCR (on filesystem) and some data to  
> database.
> But question is for which kind of data si better JCR. My opinion is  
> that
> data like photos, blogs, comments is better storage JCR and data  
> like users,
> roles, classifiers is better database.
> What do you think, is it right?

Yes, right :)

I/We have been following a similar route, put everything in JCR and  
build relational indexes via JPA where necessary. (we use Eclipse Link  
since it works on its own on OSGi, we also use Apache Sling since it  
already does 90% of what we need from a webapp).

So we have event listeners in JCR that trigger the indexing of items  
into relational tables via JPA. We can then query using JPA and  
retrieve sorted ordered list of pointers to items in JCR. I say we  
have this, but in fact we haven used it yet. Development has been  
going 6 months, we have close to 80% of the code us cases for the back  
end covered and all our query needs so far have been served by JCR  
queries. I am going to leave the functionality in place since who  
knows when someone might come up with  a massive relational join that  
cant be answered in JCR.

Looking back, I think the reason we haven't used it is we have taken  
time over modeling the structure of the content in JCR so that access  
is either direct, or there is sufficient metadata to allow JCR queries  
to work. The one massive benefit in all of this has been the  
assumption that we have no SQL schema and don't need to maintain all  
the code base that that entails. Everything is much more direct.

HTH (all IMHO)
Ian

> Thanks