During fields merging at:
// C). Add on any fields that weren't defined previously
for (int i=0;i<ormCmd.getNoOfMembers();i++)
Fields extensions in some cases are not copied from ORM metadata to the result metadata. Specifically, at:
// Create a copy of the ORM field MetaData and add to JDO MetaData
if (ormFmd instanceof FieldMetaData)
fmd = new FieldMetaData(primaryCmd, ormFmd);
fmd = new PropertyMetaData(primaryCmd, (PropertyMetaData)ormFmd);
Since FieldMetaData (in fact AbstractMemberMetaData) constructor for some reason ignores extensions, resulting field metadata fmd will not have them. This case is triggered if field does not have explicit XML JDO or Annotations metadata, but only ORM one. One line below:
// Field specified in JDO MetaData so merge in ORM MetaData
does correctly merge primaryFmd and ormFmd metadata, but this is called only when primaryFmd exists.
The same issue [probably] exists for two other cases in the same repeat block, where identical calls to FieldMetaData and PropertyMetaData constructors are done.
It seems that the code assumes that above mentioned constructors DO copy extensions. Either AbstractMemberMetaData needs to be fixed or if for some reason it is undesirable, then perhaps MetaDataMerger.mergeMemberORMData() must be called unconditionally at the end of each cycle.
Workaround for now is simple: explicitly use @Persistent annotation on every field, but I still think it is major if not critical, since you have to get deep in the code to figure this out.