I'm trying to build an index of lessons. In the Lessons-table I have a field for a previous and next lesson.
The problem is that I'd need to be able to index and make searches from those "previous lesson" and "next lesson" -fields also. But when I try to start up the server with @ManyToOne and @IndexedEmbedded -annotations in the
previousLesson I get a "Circular reference"-error. So I'd like to know how it is possible to index these referenced lessons also. I've tried searching the forum and Google, but I didn't find anything usefull. And this sounds kind of an easy problem so I thought someone could know answer for this straightly.
Thanks in advance!
Hibernate 3.2.6
Hibernate Search 3.0.1.GA
Mapping:
Code:
<many-to-one class="Lesson" fetch="join" lazy="proxy"
name="previousLesson" outer-join="false">
<column name="PrevLesson_lessonId"/>
<column name="PrevLesson_classId/>
</many-to-one>
Error:
Code:
org.hibernate.search.SearchException: Circular reference. Duplicate use of Lesson in root entity Lesson#previousLesson.
at org.hibernate.search.engine.DocumentBuilder.initializeMember(DocumentBuilder.java:252)
at org.hibernate.search.engine.DocumentBuilder.initializeMembers(DocumentBuilder.java:167)
at org.hibernate.search.engine.DocumentBuilder.<init>(DocumentBuilder.java:94)
at org.hibernate.search.impl.SearchFactoryImpl.initDocumentBuilders(SearchFactoryImpl.java:262)
at org.hibernate.search.impl.SearchFactoryImpl.<init>(SearchFactoryImpl.java:94)
at org.hibernate.search.impl.SearchFactoryImpl.getSearchFactory(SearchFactoryImpl.java:172)
at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:42)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:417)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1310)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)