Hi again, > Hi Thomas, > > Thanks for your explanations. A couple of follow-up questions... > > > > > -----Original Message----- > > From: Thomas Mahler [mailto:[EMAIL PROTECTED] > > Sent: maandag 16 juni 2003 21:46 > > To: OJB Users List > > Subject: Re: Questions re. mapping of associations... > > > > > > Hi Tim. > > > > Leeuw van der, Tim wrote: > > > Hello, > > > > > > I'm trying to convert my existing JDO-metadata mappings to an OJB > > > repository.xml ... > > > > [...] > > > > I couldn't find anywhere the use of such anonymous mappings. > > > > It's a relatively new feature and the is not available with > RC3 or on > > the Website, but it is already in CVS: > > > http://cvs.apache.org/viewcvs/db-ojb/xdocs/howto-use-anonymous > -keys.xml > > add the file to the xdocs folder of the source distro and > execute the > > ant target "xslt" and ready is your complete html docu on > this topic ! > > > > When you say that it's not available in RC3, do you mean that the > documentation for it is not available in RC3? Or does the > feature itself not > work yet in RC3?
the docs! the sentence should read "It's a relatively new feature and the *documentation* is not available with RC3" The feature itself is working fine in RC3 already! > > > > > > > Another thing which is: With JDO, I defined several > java.util.List > > fields > > > and specified that they should be stored/retrieved in order. I > > really need > > > to maintain the order of elements in the list, but I would prefer > > not to > > > have to manually do that housekeeping. > > > > you can use the collection-descriptor attributes orderby > and sort to > > maintain order: > > The orderby attribute may specify a field of the element class. The > > Collection or Array will be sorted according to the specified > > attribute. > > The sort attribute may be used to specify ascending or descending > > order > > for this operation. > > > > > > > Do I have to explicitly use odmg.DList in my code? Similar for a > > > java.util.Map; do I have to explicitly use odmg.DMap? > > > > Mhh, what do you want to achieve? using the ODMG persistent > > collections > > does not make much sense in JDO (may be I'm missing something). > > > > Sorry for confusing you here. I have some existing mappings > for JDO but I > will need to use OJB instead, achieving similar results. So I > won't be using > JDO anymore, for the moment at least. > With JDO I could use a plain java.util.List and tell the JDO > implementation > to maintain for me the order of elements so that I read them > in the same > order as I put them in the list. > > I looked at the order-by attribute of the reference > descriptor, but I can't > use that. There is no attribute in my element-classes that I > can sort on; > it's the order that I put them in the list that is relevant. Mhh, In an RDBMS there is no notion of "position in a table". If you want to have your elements to show up in a given sequence you have to use an additional column that can be used for sorting. This is not a restriction with OJB but with relational calculus in general! > My domain-model is a sort of graph, where each node in the > graph has links > to multiple other nodes. I could potentially add a > sequence-number attribute > to maintain order of the nodes for their ancestor. > However, I also need to store a path over this graph, and > each node can be > part of an unlimited number of paths. A node can even appear > multiple times > in the same path. > I need an indirection-table therefore, and my sequence-number > needs to go > into the indicrection-table. It would be horribly > inconvenient to have to > decompose the n:m mapping manually in source. > > Therefore my question: > With JDO I can achieve this with any implementation of the > java.util.List > interface that I find convenient. Is the only way that I can > achieve this > with OJB by using org.odmg.DList? You are right, the DListImpl provides such an indirection mechanism (and also maintains order of the entries in the way that you'd like to see. The only problem is that DListImpl & friends are coded to cooperate with ODMG transaction manager. They lookup the current ODMG transaction and perform locks etc. This won't be of any help in a JDO managed situation (could also cause errors). But it would be an option to reuse most of the DlistImpl code to write a collection class that does all your housekeeping, but does not try to work with ODMG transactions. > > And if I want to store a java.util.Map in the database, does > it have to be a > org.odmg.DMap instance? there is currently no other persistent map shipping with OJB apart from DMap. But for DMap you'll face the same probs as with DList... > > I want to be sure of this before I change my code and dive > into how to use > those things... I'm still in the stage of trying to find my > way with OJB. Yes, there is learning curve with OJB. It's definitely not as smooth to use as a OODBMS JDO implementation :-( cheers, Thomas > > > > cheers, > > thomas > > > > > > > > With regards, > > > > > > --Tim van der Leeuw > > > > > > > > > > > Thanks a lot, > > --Tim van der Leeuw > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
