EntityStoreException: 不支持的属性类型 id 9

huangapple go评论66阅读模式
英文:

EntityStoreException: Unsupported property type id 9

问题

使用Xodus版本 1.3.124,数据库出现以下错误:

jetbrains.exodus.entitystore.EntityStoreException: 不支持的属性类型标识 9
	at jetbrains.exodus.entitystore.tables.PropertyTypes.getPropertyType(PropertyTypes.java:56)
	at jetbrains.exodus.entitystore.tables.PropertyTypes.entryToPropertyValue(PropertyTypes.java:86)
	at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.getPropertyValue(PersistentEntityStoreImpl.java:843)
	at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.getProperty(PersistentEntityStoreImpl.java:827)
	at jetbrains.exodus.entitystore.PersistentEntity.getProperty(PersistentEntity.java:114)

尽管属性已经注册:

@Override
public PersistentEntityStore getPersistentEntityStore(String xodusRoot, String dir, boolean isReadOnly) {

  if(persistentEntityStoreCache == null) {
    persistentEntityStoreCache = buildPersistentEntityStoreCache();
  }
  PersistentEntityStore entityStore = persistentEntityStoreCache.get(xodusRoot + dir);
  if (entityStore == null) {
    Environment environment = getEnvironment(xodusRoot, dir);
    PersistentEntityStoreConfig config = new PersistentEntityStoreConfig();
    config.setManagementEnabled(false);
    config.setDebugSearchForIncomingLinksOnDelete(true);
    config.setRefactoringHeavyLinks(true);
    entityStore = PersistentEntityStores.newInstance(config, environment, "persistentEntityStore");
    PersistentEntityStore finalEntityStore = entityStore;
    entityStore.executeInTransaction(
            txn -> {
              finalEntityStore.registerCustomPropertyType(
                  txn, EmbeddedEntityIterable.class, EmbeddedEntityBinding.BINDING);
              finalEntityStore.registerCustomPropertyType(
                  txn, EmbeddedArrayIterable.class, EmbeddedEntityBinding.BINDING);
              persistentEntityStoreCache.put(xodusRoot + dir, finalEntityStore);
            });
  }
  PersistentEntityStore persistentEntityStore = persistentEntityStoreCache.get(xodusRoot + dir);
  return persistentEntityStore;
}

而此属性最初保存为:

metaDataHashMap.put("uniqueProperties", uProperties);
finalEntity.setProperty(metadataProperty, new EmbeddedEntityIterable(metaDataHashMap));

可能出了什么问题?

英文:

Using Xodus version 1.3.124 and the database is throwing:

jetbrains.exodus.entitystore.EntityStoreException: Unsupported property type id 9
	at jetbrains.exodus.entitystore.tables.PropertyTypes.getPropertyType(PropertyTypes.java:56)
	at jetbrains.exodus.entitystore.tables.PropertyTypes.entryToPropertyValue(PropertyTypes.java:86)
	at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.getPropertyValue(PersistentEntityStoreImpl.java:843)
	at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.getProperty(PersistentEntityStoreImpl.java:827)
	at jetbrains.exodus.entitystore.PersistentEntity.getProperty(PersistentEntity.java:114)

Despite the property being registered:

@Override
  public PersistentEntityStore getPersistentEntityStore(String xodusRoot, String dir, boolean isReadOnly) {

    if(persistentEntityStoreCache == null) {
      persistentEntityStoreCache = buildPersistentEntityStoreCache();
    }
    PersistentEntityStore entityStore = persistentEntityStoreCache.get(xodusRoot + dir);
    if (entityStore == null) {
      Environment environment = getEnvironment(xodusRoot, dir);
      PersistentEntityStoreConfig config = new PersistentEntityStoreConfig();
      config.setManagementEnabled(false);
      config.setDebugSearchForIncomingLinksOnDelete(true);
      config.setRefactoringHeavyLinks(true);
      entityStore = PersistentEntityStores.newInstance(config, environment, "persistentEntityStore");
      PersistentEntityStore finalEntityStore = entityStore;
      entityStore.executeInTransaction(
              txn -> {
                finalEntityStore.registerCustomPropertyType(
                    txn, EmbeddedEntityIterable.class, EmbeddedEntityBinding.BINDING);
                finalEntityStore.registerCustomPropertyType(
                    txn, EmbeddedArrayIterable.class, EmbeddedEntityBinding.BINDING);
                persistentEntityStoreCache.put(xodusRoot + dir, finalEntityStore);
              });
    }
    PersistentEntityStore persistentEntityStore = persistentEntityStoreCache.get(xodusRoot + dir);
    return persistentEntityStore;
  }

And this property was originally saved with:

metaDataHashMap.put("uniqueProperties", uProperties);
finalEntity.setProperty(metadataProperty, new EmbeddedEntityIterable(metaDataHashMap));

What could be wrong here?

答案1

得分: 0

我已经找到了问题的根本原因。

最初,EmbeddedEntityIterable 位于 com.mybusiness.model.EmbeddedEntityIterable,然后被移动到 com.my-new-business.model.EmbeddedEntityIterable

这解决了问题。然而,Xodus 应该提供一种机制来替换,或者至少在像这样的情况下替换引用,即模型被移动的情况下。

英文:

I have found the root cause of the problem.

Originally, the EmbeddedEntityIterable is under com.mybusiness.model.EmbeddedEntityIterable then was moved to com.my-new-business.model.EmbeddedEntityIterable

This solved the problem. However, it Xodus should have a facility to replace or at least replace references in cases like this the models are moved.

huangapple
  • 本文由 发表于 2020年9月25日 09:14:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/64056452.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定