Skip to content

Modifying datamodel (adding a new list to dataroot) #296

Answered by fh-ms
HansITChange asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, you are right, the vendors list is not present in the storage, so the field will be initialized with its default value (null).
There are several possibilities to introduce initial values to new fields.
One rather complex way would be to implement a Legacy Type Handler.
A far more simple one is just lazy initialization in your Customer type:

public List<Vendor> getVendors()
{
    if(this.vendors == null)
    {
        this.vendors = new ArrayList<>()
    }
    return this.vendors;
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@HansITChange
Comment options

Answer selected by HansITChange
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants