Ok, thanks I�ll work on it.
I did something ugly meanwhile at the session bean so it returns null when
there is no object...


-----Mensagem original-----
De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] nome de Harkness,
David
Enviada em: quarta-feira, 10 de dezembro de 2003 17:41
Para: [EMAIL PROTECTED]
Assunto: RE: [Xdoclet-user] problem with a get method


Dazzi, Giselle wrote:
> Hi all, I have another issue, I have defined a get method
> using xdoclet in my entity bean like this:
> 
>     * @ejb.relation
>     *    name="ItemTradeIn-ItemProposta"
>     *    role-name="ItemProposta-has-ItemTradeIn"
>     *    cascade-delete="yes"
>     *    target-multiple="yes"
>     *
>     * @weblogic:column-map
>     *    foreign-key-column="idItemTradeIn"
>     *    key-column="idItemTradeIn"
>     *
>     */
>    public abstract ...whatever....ItemTradeInLocal
> getItemTradeIn(); [/CODE]
> 
> It�s a 0..1 relationship. Even when there is no object (0)
> it�s always returning something, which is not null but it�s
> not a valid object, since I cant call its methods. When it�s
> 1 , no problem , it works fine...
> 
> Do you see something wrong in my definition above ?

Yes, this tag

>     *    target-multiple="yes"

says that the relationship is 1:N, not 1:0..1, and that the method should
return a Collection or Set. As this is not the case, change it to "no". How
that results in the behavior you're seeing I have no idea. Perhaps WebLogic
is trying to do something smart by detecting 0 related beans and creating an
empty Collection. However, that should result in a ClassCastException at
best (or not compile at worst) so I dunno what the deal is.

David Harkness
Sr. Software Engineer
Sony Pictures Digital Networks
(310) 482-4756


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to