Hi Eric,
I forwarded your email to the NetBeans guys who developed the
convertor generator code.
Paul.
On Jan 20, 2009, at 5:35 PM, Marsh Eric wrote:
> Working with the converter files generated in netbeans I noticed
> that null exceptions were being fired from the resolveEntity
> methods. The code as generated was attempting to get a collection
> but if the database didn't hold any values it would return a null
> and the exception was fired. I wrapped the for loop that referenced
> the collection with a test for null and things started working again.
>
> from:
>
> public Mylocation resolveEntity(EntityManager em) {
> Collection<People> peopleCollection =
> entity.getPeopleCollection();
> Collection<People> newpeopleCollection = new
> java.util.ArrayList<People>();
> for (People item : peopleCollection) {
> newpeopleCollection.add(em.getReference(People.class,
> item.getPk()));
> }
> entity.setPeopleCollection(newpeopleCollection);
>
> to:
>
> public Mylocation resolveEntity(EntityManager em) {
> Collection<People> peopleCollection =
> entity.getPeopleCollection();
> Collection<People> newpeopleCollection = new
> java.util.ArrayList<People>();
> if (peopleCollection != null) {
> for (People item : peopleCollection) {
> newpeopleCollection.add(em.getReference(People.class,
> item.getPk()));
> }
> }
> entity.setPeopleCollection(newpeopleCollection);
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>