I would like to extend an existing datamodel in Microstream with a new data object. E.g. I have Customers, with data records in Microstream, and I would like to add Vendors, with their own datastructure and data. As the database is not empty, I cannot start as if their is no data, however adding a list of Vendor to the dataroot doesn't seem to work. Microstream says the list is null when starting, which is correct, but I cannot add my new object to a null list. Can someone explain me how to add a vendor to my 'database' ?
Asked
Active
Viewed 112 times
2 Answers
0
You just need to add this List and store this object with the existing list again.

Zdenek Jonas
- 121
- 7
0
I received an answer from fh-ms @ Microstream:
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;
}
And that works !

HRoose
- 1
- 2