Fabian : The first approach with JCROM seems good. If I use Generics that container object might work out well. Let me try it out.
Thanks Boni -----Original Message----- From: Fabián Mandelbaum [mailto:[EMAIL PROTECTED] Sent: 29 August 2008 20:29 To: [email protected] Subject: Re: Bean to Node and Node to Bean I was thinking more like creating an object (to be annotated and stored) like this: @JcrNode public MyContainerObject { @JcrSerializedProperty private TheBeanThatYouCannotAnnotate theBean; public getTheBeanThatYouCannotAnnotate getBean() { return theBean; } } provided TheBeanThatYouCannotAnnotate implements Serializable, you can store and retrieve it with JCROM using the MyContainerObject approach. As I said, for me JCROM is more simple to use than OCM itself, but that's just my appreciation. On the other hand, can't you try to export a system view of just the node in question, and 'convert' that XML (the result of the system view export) back into the bean? Check the Interface Session API docs at http://www.day.com/maven/jsr170/javadocs/jcr-1.0/ in particular, either of this methods: |void| |*exportSystemView <http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Session.html#exportSystemView%28java.lang.String,%20org.xml.sax.ContentHandler,%20boolean,%20boolean%29>*(java.lang.String absPath, org.xml.sax.ContentHandler contentHandler, boolean skipBinary, boolean noRecurse)| Serializes the node (and if |noRecurse| is |false|, the whole subtree) at |absPath| into a series of SAX events by calling the methods of the supplied |org.xml.sax.ContentHandler|.| ||void| |*exportSystemView <http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Session.html#exportSystemView%28java.lang.String,%20java.io.OutputStream,%20boolean,%20boolean%29>*(java.lang.String absPath, java.io.OutputStream out, boolean skipBinary, boolean noRecurse)| Serializes the node (and if |noRecurse| is |false|, the whole subtree) at |absPath| as an XML stream and outputs it to the supplied |OutputStream|. Good luck! Boni Gopalan (BioImagene) escribió: > Well, annotating properties is not an option for me. That's why I am > converting to xml and mapping. If to use annotations why not use the OCM > annotations itself? > > -----Original Message----- > From: Fabián Mandelbaum [mailto:[EMAIL PROTECTED] > Sent: 29 August 2008 18:47 > To: [email protected] > Subject: Re: Bean to Node and Node to Bean > > Hello Boni, > > I'm trying JCROM which is similar to (but IMVHO, simpler than) OCM > and allows you to annotate somehow classes that implement the > Serializable interface. > > Please have a look here: > http://code.google.com/p/jcrom/wiki/SerializedChild to see if it would > fit you. Good luck! > > > Boni Gopalan (BioImagene) escribió: > >> Hi I want to store and retrieve Java Beans into Jackabbit w/o using OCM. >> Why I do not want to use OCM is because I might not be able to annotate >> all the Java Beans that I want to store to my repository. So if there >> is an approach that does not need annotations to the fields I am all >> ears for that too. >> >> >> >> What I am doing currently is to use the Castor API to convert Java Beans >> to XML and then convert the XML to a Node. This part works pretty well. >> The problem is when I want to do the reverse. I cannot get the right >> starting point to convert a javax.jcr.Node to an xml structure. To me >> it feels like conversion of a Node to XML API should be readily >> available and for some reason I am not able to get my hands on it. Do >> you know how to do what I am trying to do? >> >> >> >> Thanks >> >> Boni >> >> >> >> >> >> >> >> > >
