Enhancement 234 : ENHANCEMENT - Automatically add empty sets instead of null
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.5.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
05/03/2010
Updated 
05/03/2010
Type 
Enhancement
 
Attachments 
No attachments

Refer to http://www.avaje.org/topic-172.html

public Set<Usergroup> getGroups() {
    if ( groups == null ) {
      final BeanSet<Usergroup> set = new BeanSet<Usergroup>();
      set.setModifyListening(BeanCollection.ModifyListenMode.ALL);
      setGroups(set);
    }
    return groups;
  }

Consider changing the enhancer to automatically add the "null protection" type code for *ToMany properties.

 
Rob 13 Mar 00:49
Fixed in HEAD

You can specify checkNullManyFields=false to explicitly turn off this enhancement option.

For example:
To turn off the checkNullManyFields and use debug level of 4 for enhancement ...

debug=4;checkNullManyFields=false

Eabin 01 May 12:31
Only for enhanced classes?

Sorry for the necromancy, but I was wondering if this should work with automatically generated subclasses too? Because I just upgraded to 2.7.5, and was looking forward to removing some of the old null-checks - but it does not seem to work.

If not, is there some documentation on how to run the enhancer automatically on startup (is this even possible, or does it need to run at compile time?)

woResponse

Upload a file