Reference mapping problem

4 views
Skip to first unread message

helleni...@gmail.com

unread,
Feb 22, 2009, 6:32:01 PM2/22/09
to jcrom
Hello jcrom team!

I began now to use Jcrom and I like it! Your documentation is good and
clear
and this is something important for me.

Until now everything is fine.

I have the following node structure:
nodeA
- nodesB
- contentNode
- nodesC
- referencedNode

contentNode has a JcrReference(byPath = true) annotation on a
referencedNode object.
A reference in the same hierarchy. But the reference is not saved. I
think it tests the object
property for null and since referencedNode is not saved and has no
path the mapping fails.

I have no error message, just the reference property is missing.

best regards

helleni...@gmail.com

unread,
Feb 23, 2009, 9:49:53 AM2/23/09
to jcrom
I tried to use a "normal" reference with uuid. But this property is
missed too.
I tried to save my object, then read it again and update it. I thought
maybe this
would fill in the reference property, but this was not the case.

best regards


On 23 Feb., 00:32, "hellenicgen...@gmail.com"

Ólafur Gauti Guðmundsson

unread,
Feb 23, 2009, 2:34:31 PM2/23/09
to jcrom
Hi there,
Maybe this is not clear from the documentation:

1) JCROM does not update the properties or child nodes of a referenced
object, it only updates the reference itself.
2) If class A has a reference of class B, then the node for class B
must already exists to allow it to be referenced by class A.

Does this explain your problem?

Regards,
OGG

On Feb 23, 2:49 pm, "hellenicgen...@gmail.com"

helleni...@gmail.com

unread,
Feb 24, 2009, 8:45:00 AM2/24/09
to jcrom
Hello,

thanks for your answer. Maybe I have to design it another way.
My problem is that class A has a ref to class B. And the two classes
are childnodes of class C. And now I will save my new class C...

I think about it. But Jcrom still does a good job! :)

best regards

On 23 Feb., 20:34, Ólafur Gauti Guðmundsson <oli.ga...@gmail.com>
wrote:

Ólafur Gauti Guðmundsson

unread,
Feb 25, 2009, 6:10:38 AM2/25/09
to jcrom
Hi,
If you send me your classes, or even a unit test, I'll have a look and
see if I can advice you further.

Regards,
OGG

On Feb 24, 1:45 pm, "hellenicgen...@gmail.com"

helleni...@gmail.com

unread,
Mar 1, 2009, 1:35:28 PM3/1/09
to jcrom, Ólafur Gauti Guðmundsson
Hello Ogg,

thank you, I appreciate your help.

@Test
public void newConversation() {
Conversation conversation = new Conversation();
Subscriber subscriber1 = new Subscriber("an Id");
Subscriber subscriber2 = new Subscriber("another Id");

conversation.addSubscriber(subscriber1);
conversation.addSubscriber(subscriber2);

Message message = new Message(subscriber1, "a message");
conversation.publish(message);
}

I hope you understand the basic structure I want to map. I want to
save the conversation.

best regards

On 25 Feb., 12:10, Ólafur Gauti Guðmundsson <oli....@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages