在ActiveObjects中,实体模式版本以注释的形式存储在实体类的代码中。这些注释包含了版本号和与该版本关联的数据库表的信息。例如:
// This is version 1 of the entity schema // AO_TABLE_NAME=MyEntityTable // AO_COLUMN_NAME=myColumn // AO_COLUMN_TYPE=VARCHAR(255) // AO_PK_COL=ID:BIGINT(19)
可以通过ActiveObjects的API来检索实体类的注释,例如:
AOEntityDescriptor descriptor = entityManager.getEntityDescriptor(MyEntity.class); String[] schemaVersions = descriptor.getSchemaVersions();
这将返回MyEntity类中所有版本的实体模式版本。