You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Tim Drury <td...@siliconmotorsports.com> on 2003/03/01 03:29:52 UTC
ojb returns empty collections instead of null
When I retrieve an object from the database via OJB which
has a collection of child objects, but there are no child
objects in the database, OJB fills the parent object
collection reference with an empty collection instead of
keeping the collection reference null.
Is there a way to have OJB keep the reference null? Is
there a benefit to having the empty collection as opposed
to a null reference?
-tim
Re: ojb returns empty collections instead of null
Posted by Thomas Mahler <th...@web.de>.
Hi Tim,
Tim Drury wrote:
> When I retrieve an object from the database via OJB which
> has a collection of child objects, but there are no child
> objects in the database, OJB fills the parent object
> collection reference with an empty collection instead of
> keeping the collection reference null.
>
> Is there a way to have OJB keep the reference null?
Not with out a change to the OJB codebase.
> Is
> there a benefit to having the empty collection as opposed
> to a null reference?
1. It's simpler to implement this way.
2. In case you want to add elements to the collection-attribute you
don't need a null pointer check.
I admit: not very strong reasons. But you are the first to complain
about this feature in this century ;-)
cheers,
thomas
> -tim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>