David Zejda wrote:
I need bidirectional 1:n relation, but I'm still mising something... Please, have a look on a two simple classes.
package oit.ucase;
/** * @ojb.class include-inherited="true" * table="USECASE_HIERARCHY" */ public class Deposit { /** * Artificial ID key holder * * @ojb.field nullable="false" * autoincrement="ojb" * primarykey="true" */ private int a_id;
/** * @ojb.collection element-class-ref="oit.ucase.DepositIndulgence" * collection-class="java.util.TreeSet * foreignkey="deposit_id" * auto-retrieve="true" * auto-update="true" * auto-delete="true" */ private java.util.SortedSet indulgences = new java.util.TreeSet(); }
package oit.ucase;
/** * @ojb.class include-inherited="true" * table="USECASE_HIERARCHY" */ public class DepositIndulgence { /** * Referential ID key holder * * @ojb.field */ private int deposit_id;
/** * Holds value of property deposit. * * @ojb.reference class-ref="oit.ucase.Deposit" * foreignkey="deposit_id" * auto-retrieve="true" * auto-update="false" * auto-delete="false" */ private Deposit deposit; }
You have a missing quotation mark for the collection-class attribute, and thus the remaining attributes are off. If you're using eclipse, you might want to try the doclipse plugin which helps a lot with xdoclet tags.
Btw, I don't think that TreeSet works as the collection-class, you should use one of the classes provided by OJB. Same for using SortedSet as the variable type - you have to use Set here. You shouldn't need to specify TreeSet as the collection-class anyway as OJB maintains the order that the objects are inserted. So you should be fine with
/**
* @ojb.collection element-class-ref="oit.ucase.DepositIndulgence"
* foreignkey="deposit_id"
* auto-retrieve="true"
* auto-update="true"
* auto-delete="true"
*/
private java.util.Set indulgences = new java.util.TreeSet();Tom
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
