I have a relation book-orders (an order contains several books, a book can be part of several orders). I've been able to set up a bidirectional relationship by decorating getBooks in Order and getOrders in Book with something like:
/** | * @ejb.relation | * name = "orderbooks" | * role-name = "book-belongs_to-orders" | * target-ejb = "OrderEJB" | * target-role-name = "order-has-books" | * | * @jboss.relation | * fk-column = "id" | * related-pk-field = "id" | * @jboss.relation-table | * table-name = "orderbooks" | * | * @ejb.interface-method | */ | public abstract Collection getOrders(); | | and | | /** | * @ejb.relation | * name = "orderbooks" | * role-name = "order-has-books" | * target-ejb = "BookEJB" | * target-role-name = "book-belongs_to-orders" | * | * @jboss.relation | * fk-column = "isbn" | * related-pk-field = "isbn" | * jdbc-type = "VARCHAR" | * sql-type = "VARCHAR(20)" | * @jboss.relation-table | * table-name = "orderbooks" | * | * @ejb.interface-method | */ | public abstract Collection getBooks(); | Since the relation is bidirectional I can expect that each time I use a finder to retrieve an order all the related books are loaded too (ok, the container can apply lazy loading and so on, but the concept holds). But this is true even when I retrieve a Book which is not what I want, I don't want to load all the related orders. I guess this is the case for unidirectional relationships. If what I wrote makes sense (it might not be the case since I haven't been able to find a good reference about it) how do I set up this kind of CMR with XDoclet? Thanks, Davide. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3841202#3841202 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3841202 ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ JBoss-Development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
