Hi Tim.

Leeuw van der, Tim wrote:
Hello,

I'm trying to convert my existing JDO-metadata mappings to an OJB
repository.xml ...

I'm running into a few things that puzzle me.

When there's an association between 2 objects, for instance ProductGroup and
Article, the Article class has a field ProductGroupId to hold the the id of
the product to load.
That's not what I would call non-intrusive; I now have to add this field to
all my domain-classes.

You don't need foreign-key attributes in your jave classes if you are using the anonymous fields feature!



2nd, there's mention of access="anonymous". Such fields are in the database but not in my java class. Could I use such an anonymous field for mapping the association? That way I don't have to modify my java classes.

That's exactly what I'm proposing!


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 !



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).


cheers,
thomas


With regards,


--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]



Reply via email to