The very strange error I was getting below has somehow fixed itself. It 
fixed when I moved the problematic code to the top of my methods 
in the java file (before all the CMP field accessors) .

Now, I have another question about usage of XDoclet-generated Value 
Objects and CMR:

If a Person exposes the CMR methods: 

public abstract Collection getAddresses();
public abstract void setAddresses( Collection addresses ) ;

how do you add or delete a single address ? 
Do you do it via the collection ? 
is this pseudocode the correct procedure : 

1) Collection col = person.getAddresses()
2) AddressLocal addrLocl = AddressLocalHome.create ( myAddressVal ) 
3) addrLocal.setPerson ( person ) 
4) col.addItem ( addrLocl.getAddressValue () )
5) person.setAddresses ( col ) 

In the Value Object doc there is some mention of auto-generated add 
methods for CMR fields, and for the parent object to be able to be 
responsible for the creation of child objects...  but I dont see them... 
what is the best practice 
for utilizing the very powerful feature of XDoclet's CMR-powered value 
objects, when updating or deleting data from the database ? 

p.s. this is for a relation defined by
1 Person <-> many Addresses
with the person FK residing in the Address table 


again, I apologize for the newbie question, any help is greatly 
appreciated. 

Thanks

Nat

On Thu, 20 Feb 2003, Nathaniel Rahav wrote:

> 
> Dear list, 
> 
> I am trying to get the ValueObject generation working for CMR fields as 
> described in the ValueObject documentation, but I am getting an error in 
> XDoclet's code generation. If anybody can tell me how to fix this error I 
> would be most grateful. 
> BTW I am using 1.2b2 built from the binary, with ant1.5.1
> 
> I have added an entry almost identical to the example (and to xpetstore) 
> to my file Person.java : 
> 
>  /** 
>      * Get the Addresses for this Person
>      * @return Collection of Addresses. 
>      * @ejb.interface-method 
>      * @ejb.relation 
>      *      name="person_address_1_to_n" 
>      *      role-name="person" 
>      * @ejb.value-object
>      *      compose="rpmaster.server.data.beans.AddressValue
>      *      compose-name="Addresses"
>      *      members="rpmaster.server.data.beans.AddressLocal"
>      *      members-name="Address"
>      *      relation="external"
>      *      type="Collection"
>      * @jboss.target-relation 
>      *      related-pk-field="personUId" fk-column="person_id" 
>      */ 
>     public abstract Collection getAddresses();
> 
> 
> when I am running XDoclet I get an error here : 
> 
> [ejbdoclet] Generating Value Object class: 
> 'rpmaster.server.data.beans.PersonBean--> rpmaster.server.data.beans.PersonValue'.
> [ejbdoclet] (TemplateEngine.invokeMethod         490 ) Invoking method 
> failed: xdoclet.modules.ejb.entity.PersistentTagsHandler.forAllPersistentFields, 
> line=19 
> of template file: 
> jar:file:/opt/dev/rpmaster/lib/main/xdoclet-current/xdoclet-ejb-module-1.2b2.jar!/xdoclet/modules/ejb/entity/resources/valueobject.xdt
> [ejbdoclet] java.lang.reflect.InvocationTargetException
> 
> further down the trace it gives this indication as to why that method 
> failed: 
> 
> [ejbdoclet] Caused by: java.lang.NullPointerException
> [ejbdoclet]     at 
> xdoclet.modules.ejb.entity.PersistentTagsHandler.isValueObjectField(PersistentTagsHandler.java:84)
> [ejbdoclet]     at 
> xdoclet.modules.ejb.entity.PersistentTagsHandler.forAllPersistentMatchedFields(PersistentTagsHandler.java:420)
> 
> 
> for the full stack trace please see: 
> http://www.busquelo.org/XDocletStackDump.txt
> 
> 
> 
> When I remove the value-object tag from that method, XDoclet runs without 
> any errors. Anybody know what I'm doing wrong ??? 
> 
> Thanks
> 
> Nat
> 
> 



-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to