Hi,
Since I'am evaluation xdoclet - especially the weblogic substask (EJB2.0,
using CMR), I wrote a little test program using all relation types. I am
using xdolcet 1.1.2 and stepped into some problems. There has been already a
post about a problem with unidirectional Many-to-One relations a week before
which is called a bug, but maybe it has to do with my problem here. For me
it is not very clear when to use one of the tags 'weblogic:column-map' and
'weblogic:target-column-map'.
I found out, that the xdoclet weblogic subtask definition might not be
complete - e.g. it offers only ONE WAY to model a unidirectional one-to-one
relation, whereas I know at least two ways to model it in the database.
Let me describe:
Imagine two tables PERSONS and PASSPORTS. To model a 1:1 relationship
(besides using the same pk in both tables) you can insert the FK in either
the first or the second table:
A)
---PERSONS-- --PASSPORTS--
pk pk
fk_person
B)
---PERSONS-- --PASSPORTS--
pk pk
fk_passport
Both cases are valid database models and are supported by the weblogic rdbms
descriptor by declaring the foreignkey mapping just below the appropriate
role-name.
Now, writing the xdoclet tags for case A into PersonBean.java is easy. Doing
it for case B seems to be impossible, since I don't know how I could tell
the weblogic subtask to use the other table for the foreign key mapping.
Here is the correct declaration for case A:
(Please note, that I am talking about unidirectional relations.)
---PersonBean----
/**
* @ejb:interface-method
* @ejb:relation
* name = "Person-Passport"
* role-name = "Person-has-Passport"
* target-ejb = "Passport"
* target-role-name = "Passport-of-Person"
* @weblogic:column-map
* foreign-key-column = "FK_PASSPORT"
* key-column = "PK"
*/
public abstract PassportLocal getPassport();
To declare case B you can not just replace the name of the foreign key
column, since the weblogic subtask then assumes, you just renamed the name
of the foreign key in the PASSPORTS table which is not exactly what you
want.
* @weblogic:column-map
* foreign-key-column = "FK_PERSON" <----no way!!!
* key-column = "PK"
Another try is using the existing tag @weblogic:target-column-map instead of
@weblogic:column-map, but this does not help either, since the xdoclet
generator is not prepared for this but generates no mapping definition for
this relation into the weblogic-rdbms-jar.xml at all. The following code
example shows this (not working) declaration:
---PersonBean----
/**
* @ejb:interface-method
* @ejb:relation
* name = "Person-Passport"
* role-name = "Person-has-Passport"
* target-ejb = "Passport"
* target-role-name = "Passport-of-Person"
* @weblogic:target-column-map
* foreign-key-column = "FK_PERSON"
* key-column = "PK"
*/
public abstract PassportLocal getPassport();
I am not sure, if this is intended to work anyway, since this would be the
only case, where inside a relation declaration you only have a
@weglogic:target-column-map but no @weglogic:column-map.
Does anybody know how to solve this? Is there another way I forgot?
Michael.
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user