You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by dan <da...@hotmail.com> on 2006/09/05 21:18:27 UTC

Node.addNode(relPath, nodeType) and javax.jcr.nodetype.ConstraintViolationException

Hi all,

Hope this will be a quick question: 

I have the following CND file:
[myCM:document] 
+* (myCM:field)   copy
[myCM::docReferenceField] > myCM:field
+* (myCM:documentReference) = myCM:documentReference
  multiple copy
[myCM:documentReference] >.....
...

When I call the addNode method of Node D (myCM:document) as below:
D.addNode("new document", "myCM:docReferenceField");

JackRabbit throws  javax.jcr.nodetype.ConstraintViolationException. This is
not correct, is it? 

(According to the specification on child node definition: 
"... but rather that its primary node type (whatever else it may be) must be
at least a subtype of both node types X and Y. Of course, inheritance is
also respected in the simpler case where this attribute specifies only one
primary node type. If it specifies, for example, type T, this means that the
child node must be of type T or a subtype of type T...")

Thanks,
Dan


Re: Node.addNode(relPath, nodeType) and javax.jcr.nodetype.ConstraintViolationException

Posted by David Nuescheler <da...@gmail.com>.
Hi Dan,

> [myCM::docReferenceField] > myCM:field
> +* (myCM:documentReference) = myCM:documentReference
>  multiple copy

Other than the typo with the two colons in sequence, I can't see
anything wrong with it...

I tried your nodetypes on our public UI http://jcr.day.com and it
worked just fine. Just hit "Content Explorer" and find
"danz8086 at hotmail.com" at the bottom of the left hand tree.

regards,
david

Re: Joins in SQL and searching for node by nodeType

Posted by David Nuescheler <da...@gmail.com>.
Hi Dan,

> While googling for more info on Jackrabbit's search capability, I came
> across this message by Marcel Reutegger on Aug 2005: http://www.mail-archive.com/jackrabbit-dev@incubator.apache.org/msg02366.html
> One of the facts outlined by Marcel is that "joins in SQL are not supported
> in jackrabbit".
> Is this still the case as of Jackrabbit 1.0.1?
> Another question is, what is the best way to do something like
> node.getNodes(NodeType), which returns only those child nodes of specified
> nodeType (or subtypes of given type)?
In some cases where I had users ask for functionality like this, it sometimes
was rooted in a suboptimal content model. Of course nobody can be blamed,
since I guess we all remember our first relational data model before reading
any books or getting any education on how to build scalable and efficient
datamodels (which in the case of JCR is currently not really possible)

Do you mind sharing your content model and use case? This may help
us understand what people are trying to achieve with JCR and roll some
of that experience into future revisions of the specification and
implementation.

regards,
david

node.remove() causes "out of memory" error

Posted by dan <da...@hotmail.com>.
Hi,

I wanted to delete a node which has over 5000 immediate sub nodes; each of
the sub nodes has their own child nodes. 
When I call node.remove(), the application hang and after about 10 minutes
or so, the server started to complain that it could not allocate memory from
the heap. (WebSphere 6)

The message is "JVMST109: Insufficient space in Javaheap to satisfy
allocation request
JVMST109: Insufficient space in Javaheap to satisfy allocation request
JVMDG217: Dump Handler is Processing OutOfMemory - Please Wait."

Other than forcing garbage collection, is there anything else behind this
issue? Has anyone else encountered such problem? 

Thanks,
D


Re: Joins in SQL and searching for node by nodeType

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 9/7/06, dan <da...@hotmail.com> wrote:
> One of the facts outlined by Marcel is that "joins in SQL are not supported
> in jackrabbit". Is this still the case as of Jackrabbit 1.0.1?

Yes, and it will be the case also for the upcoming 1.1 release. I'm
not aware of any current efforts to implement more complex relational
operations in Jackrabbit.

> Another question is, what is the best way to do something like
> node.getNodes(NodeType), which returns only those child nodes of specified
> nodeType (or subtypes of given type)?

You can either filter the full list of child nodes returned by
Node.getNodes() or use the XPath element() function in a search like
"/jcr:root/path/to/node/element(*,my-node-type)".

BR,

Jukka Zitting

-- 
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftsmanship, JCR consulting, and Java development

Joins in SQL and searching for node by nodeType

Posted by dan <da...@hotmail.com>.
Hi,
While googling for more info on Jackrabbit's search capability, I came
across this message by Marcel Reutegger on Aug 2005:
http://www.mail-archive.com/jackrabbit-dev@incubator.apache.org/msg02366.htm
l
One of the facts outlined by Marcel is that "joins in SQL are not supported
in jackrabbit". 
Is this still the case as of Jackrabbit 1.0.1? 

Another question is, what is the best way to do something like 
node.getNodes(NodeType), which returns only those child nodes of specified
nodeType (or subtypes of given type)? 

Any advise is appreciated.

Regards,
Dan







RE: Node.addNode(relPath, nodeType) and javax.jcr.nodetype.ConstraintViolationException

Posted by dan <da...@hotmail.com>.
Hi Stefan & David,
You are both right that the exception was correct. Somehow part of an older
version of the code was brought back to my workspace from the CVS. A
conflict of node type definitions caused this problem. 
Sorry about the false alarm. 
Regards,
Dan




> -----Original Message-----
> From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
> Sent: September 6, 2006 4:30 AM
> To: users@jackrabbit.apache.org
> Subject: Re: Node.addNode(relPath, nodeType) and
> javax.jcr.nodetype.ConstraintViolationException
> 
> hi dan
> 
> On 9/5/06, dan <da...@hotmail.com> wrote:
> > Hi all,
> >
> > Hope this will be a quick question:
> >
> > I have the following CND file:
> > [myCM:document]
> > +* (myCM:field)   copy
> > [myCM::docReferenceField] > myCM:field
> > +* (myCM:documentReference) = myCM:documentReference
> >   multiple copy
> > [myCM:documentReference] >.....
> > ...
> >
> > When I call the addNode method of Node D (myCM:document) as below:
> > D.addNode("new document", "myCM:docReferenceField");
> >
> > JackRabbit throws  javax.jcr.nodetype.ConstraintViolationException. This
> is
> > not correct, is it?
> 
> i am pretty confident that the exception is correct and that there's
> something
> wrong with your node type defintions or your application code,
> but i might be wrong... ;)
> 
> if you're positive that it is none of the above, please post a jira issue
> and
> include your node type definitions and a simple test case.
> 
> cheers
> stefan
> 
> >
> > (According to the specification on child node definition:
> > "... but rather that its primary node type (whatever else it may be)
> must be
> > at least a subtype of both node types X and Y. Of course, inheritance is
> > also respected in the simpler case where this attribute specifies only
> one
> > primary node type. If it specifies, for example, type T, this means that
> the
> > child node must be of type T or a subtype of type T...")
> >
> > Thanks,
> > Dan
> >
> >


Re: Node.addNode(relPath, nodeType) and javax.jcr.nodetype.ConstraintViolationException

Posted by Stefan Guggisberg <st...@gmail.com>.
hi dan

On 9/5/06, dan <da...@hotmail.com> wrote:
> Hi all,
>
> Hope this will be a quick question:
>
> I have the following CND file:
> [myCM:document]
> +* (myCM:field)   copy
> [myCM::docReferenceField] > myCM:field
> +* (myCM:documentReference) = myCM:documentReference
>   multiple copy
> [myCM:documentReference] >.....
> ...
>
> When I call the addNode method of Node D (myCM:document) as below:
> D.addNode("new document", "myCM:docReferenceField");
>
> JackRabbit throws  javax.jcr.nodetype.ConstraintViolationException. This is
> not correct, is it?

i am pretty confident that the exception is correct and that there's something
wrong with your node type defintions or your application code,
but i might be wrong... ;)

if you're positive that it is none of the above, please post a jira issue and
include your node type definitions and a simple test case.

cheers
stefan

>
> (According to the specification on child node definition:
> "... but rather that its primary node type (whatever else it may be) must be
> at least a subtype of both node types X and Y. Of course, inheritance is
> also respected in the simpler case where this attribute specifies only one
> primary node type. If it specifies, for example, type T, this means that the
> child node must be of type T or a subtype of type T...")
>
> Thanks,
> Dan
>
>