2013-10-31 40 views
4

我試圖在一個大對象模型(> 200個實體)的項目中使用Hibernate Search(4.4.0)。其中,我只想索引幾個實體;目前只有一個。我在實體中添加了@Indexed,@DocumentId和@Field註解。Hibernate搜索嘗試猜測未索引實體的現場橋樑

但是,當我部署我的工件並啓動應用程序服務器時,出現錯誤消息「HSEARCH000135:無法在[type]中爲[字段]猜測FieldBridge」相同的持久性單元,但與索引實體完全無關。

我不想爲實體主鍵指定自定義fieldbridges,我不打算索引,因爲這需要很長時間才能在完整的對象模型上實現。

我的問題是:爲什麼會發生這種情況?有沒有辦法解決?

僅供參考,完整的堆棧跟蹤是如下:

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 
+1

嗨,你可以顯示實體這是失敗的啓動映射?這(顯然)不應該發生,所以我需要弄清楚你是如何觸發它的。理想情況下,如果您可以在https://hibernate.atlassian.net/browse/HSEARCH – Sanne

+0

上對新創建的JIRA問題進行描述,它由java.sql.Timestamp類型的主鍵和由@ManyToOne關係組成的組合鍵其他實體。如果這不能幫助您重現問題,我可以嘗試設置一個顯示正在發生的事情的小型項目。 – Rubrick

+0

非常感謝,我已經看到了什麼問題。創建https://hibernate.atlassian.net/browse/HSEARCH-1447 – Sanne

回答

相關問題