-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Circular reference -error. Needed for indexing and searching
PostPosted: Wed Oct 22, 2008 3:31 am 
Newbie

Joined: Tue Sep 23, 2008 10:48 am
Posts: 7
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)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 22, 2008 3:59 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

How does your annotated entity look like. Do you specify the depth parameter with @IndexEmbedded? Check the online reference for this parameter. It is needed to avoid circular references.

Hope that helps.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 22, 2008 5:59 am 
Newbie

Joined: Tue Sep 23, 2008 10:48 am
Posts: 7
Yup, that solved it. Thanks a lot!

And the solution was even easier than I thought. This is a bit embarrassing :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.