In my project, I have cached foreign annotations and did all insert and delete cascading manually, but I am now trying to update my code to use the new foreignAutoCreate annotation and I noticed a few issues. The first one is that DatabaseFieldConfigLoader does not add this field to the generated config file. The appropriate code would seem to be missing around line 212 of version 4.29 of that class.
Even after manually adding the definition to the config file, it seems that it does not get correctly set when loading the config file. On line 102 of the MappedCreate class, tableInfo.isForeignAutoCreate() returns false for classes that do have the annotation set
For reference, this is how I declared my class member:
@DatabaseFieldSimple
@DatabaseFieldForeign(foreign = true, foreignAutoRefresh=true, foreignAutoCreate=true)
public Response response;
And my child class Response has the following id field
@DatabaseFieldSimple
@DatabaseFieldId(generatedId = true)
public int id;
Any ideas?
Unfortunately, the
foreignAutoRefreshfield (and alsoversion) are not being configured correctly using theDatabaseFieldConfigLoader— both for reading and writing of the class configuration. I’ve opened this bug and fixed it in trunk. The fix was added to ORMLite in version 4.30.I’ve added comments to the end of @DatabaseField to [hopefully] protect from this in the future.
Sorry for the bug.