-->
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: Calendar attribute...how to index?
PostPosted: Tue Dec 16, 2008 6:43 pm 
Beginner
Beginner

Joined: Mon Aug 22, 2005 1:22 am
Posts: 36
Need help on this one.

I have a date attribute on my object. I have it declared as the following:

@Temporal(TemporalType.DATE)
@Field( index = Index.UN_TOKENIZED )
private Calendar date;

However, when I index my object, I get the following exception:

INFO - Version - Hibernate Search 3.1.0.GA
INFO - Version - Hibernate Commons Annotations 3.1.0.GA
org.hibernate.HibernateException: could not init listeners
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at com.positiontech.hib.HibernateUtil.<clinit>(HibernateUtil.java:115)
at ReindexSearchItems.main(ReindexSearchItems.java:19)
Caused by: org.hibernate.search.SearchException: Unable to guess FieldBridge for date
at org.hibernate.search.bridge.BridgeFactory.guessType(BridgeFactory.java:183)
at org.hibernate.search.engine.DocumentBuilderContainedEntity.bindFieldAnnotation(DocumentBuilderContainedEntity.java:465)
at org.hibernate.search.engine.DocumentBuilderContainedEntity.checkForField(DocumentBuilderContainedEntity.java:323)
at org.hibernate.search.engine.DocumentBuilderContainedEntity.initializeMemberLevelAnnotations(DocumentBuilderContainedEntity.java:204)
at org.hibernate.search.engine.DocumentBuilderContainedEntity.initializeClass(DocumentBuilderContainedEntity.java:146)
at org.hibernate.search.engine.DocumentBuilderContainedEntity.init(DocumentBuilderContainedEntity.java:106)
at org.hibernate.search.engine.DocumentBuilderIndexedEntity.init(DocumentBuilderIndexedEntity.java:147)
at org.hibernate.search.engine.DocumentBuilderContainedEntity.<init>(DocumentBuilderContainedEntity.java:93)
at org.hibernate.search.engine.DocumentBuilderIndexedEntity.<init>(DocumentBuilderIndexedEntity.java:128)
at org.hibernate.search.impl.SearchFactoryImpl.initDocumentBuilders(SearchFactoryImpl.java:409)
at org.hibernate.search.impl.SearchFactoryImpl.<init>(SearchFactoryImpl.java:119)
at org.hibernate.search.event.ContextHolder.getOrBuildSearchFactory(ContextHolder.java:30)
at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:59)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)

Any thoughts on what the issue is? Did I declare the date value correct?

Thanks
- Doug


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2008 12:45 pm 
Hibernate Team
Hibernate Team

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

try using a java.util.Date instead of Calendar. The former comes with a built in bridge in Search, the latter not.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2008 2:21 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
I'm going to open a JIRA anyway: it makes sense to create a new built in bridge, or at least throw a better exception.
IMHO we should make sure to create a "built-in" bridge for all types supported by core.

_________________
Sanne
http://in.relation.to/


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.