gpt4 book ai didi

java - Hibernate Search 尝试猜测未索引实体的字段桥

转载 作者:搜寻专家 更新时间:2023-11-01 03:53:01 24 4
gpt4 key购买 nike

我正在尝试在具有大型对象模型(>200 个实体)的项目中使用 Hibernate Search (4.4.0)。其中,我只想索引几个实体;目前只有一个。我根据需要为实体添加了@Indexed、@DocumentId 和@Field 注释。

但是,当我部署我的工件并启动应用程序服务器时,对于位于相同的持久化单元,但与索引实体完全无关。

我不想为我不打算索引的实体主键指定自定义字段桥,因为这将需要很长时间才能在完整的对象模型上实现。

我的问题是:为什么会这样?有什么办法解决这个问题吗?

作为引用,完整的堆栈跟踪如下:

org.hibernate.search.SearchException: HSEARCH000135: Unable to guess FieldBridge for <field> in <type>
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:100)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: org.hibernate.search.SearchException: HSEARCH000135: Unable to guess FieldBridge for <field> in <type>
at org.hibernate.search.bridge.impl.BridgeFactory.guessType(BridgeFactory.java:432)
at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.checkDocumentId(AnnotationMetadataProvider.java:159)
at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeMemberLevelAnnotations(AnnotationMetadataProvider.java:625)
at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.initializeClass(AnnotationMetadataProvider.java:338)
at org.hibernate.search.engine.metadata.impl.AnnotationMetadataProvider.getTypeMetadataFor(AnnotationMetadataProvider.java:118)
at org.hibernate.search.engine.spi.AbstractDocumentBuilder.<init>(AbstractDocumentBuilder.java:100)
at org.hibernate.search.engine.spi.DocumentBuilderContainedEntity.<init>(DocumentBuilderContainedEntity.java:62)
at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:342)
at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:217)
at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:141)
at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:74)
at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:52)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:558)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1746)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:197)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$500(PersistenceUnitServiceImpl.java:57)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:96)
... 4 more

最佳答案

所以这是一个错误 (https://hibernate.atlassian.net/browse/HSEARCH-1447),现在已经修复了很长时间。解决方案是至少使用 4.4.3.Final 版本的 Hibernate Search。

关于java - Hibernate Search 尝试猜测未索引实体的字段桥,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19711261/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com