-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate search with entity-name
PostPosted: Sun Jun 20, 2010 12:28 am 
Newbie

Joined: Sat Jun 19, 2010 9:02 am
Posts: 2
We have a requirement to implement Lucene search in our application. And the design is as follows.
1) Every model class (or the java bean mapping to xml) should have an interface (rather we are following interface design for model classes). So we have defined an entity-name attribute for class something like

<class name="com.test.bean.hibernate.VideoHibernateImpl" table="video" entity-name="Video">
</class>
--------- Java bean class here -----------
@Entity
@Indexed(index="Video")
public class VideoHibernateImpl implements Video, Serializable, Cloneable {


@DocumentId(name = "videoId")
@Field(name = "videoId", index = Index.UN_TOKENIZED, store = Store.NO)
private Long id;
}

2) We have been configuring the session factory (wrapped up in transaction manager) as
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>

<property name="mappingResources">
<list>
<value>com/test/bean/hibernate/Video.hbm.xml</value>
</list>
</property>
<property name="eventListeners">
<map>
<entry key="post-update">
<bean class="org.hibernate.search.event.FullTextIndexEventListener" />
</entry>
</property>
</bean>

When I run the application I am getting the following error.

Caused by: java.lang.NullPointerException
at org.hibernate.search.store.DirectoryProviderFactory.getDirectoryProviderName(DirectoryProviderFactory.java:354)
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProviders(DirectoryProviderFactory.java:65)
at org.hibernate.search.impl.SearchFactoryImpl.initDocumentBuilders(SearchFactoryImpl.java:260)
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:44)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:356)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1304)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:855)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:774)


Last edited by kishore78 on Tue Jun 22, 2010 3:00 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Hibernate search with entity-name
PostPosted: Mon Jun 21, 2010 5:35 am 
Hibernate Team
Hibernate Team

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

you might be running into this bug - HSEARCH-444.
Why are you using entity-name here?


Top
 Profile  
 
 Post subject: Re: Hibernate search with entity-name
PostPosted: Tue Jun 22, 2010 2:59 am 
Newbie

Joined: Sat Jun 19, 2010 9:02 am
Posts: 2
Hi Hardy,

Thanks for the reply. It looks like, I am running into the same issue which you referred. How can I get that fix into my search? Hope, I had to download the source apply the patch or changes then re-build. For information, we are using hibernate-search Hibernate Search 3.0 version.

We are referring these entity-names ( like "Video") in named-queires, while saving the reference is interface (and we are using session.save("Video", Object)) and other reference associations (when this video is associated to other entities). Please find the following example.


<class name="com.test.bean.hibernate.VideoTagHibernateImpl" table="video_tag" entity-name="VideoTag">
<composite-id name="id" class="com.test.bean.hibernate.VideoTagId">
<key-property name="videoId" type="java.lang.Long">
<column name="video_id" />
</key-property>
<key-property name="tagId" type="java.lang.Long">
<column name="tag_id" />
</key-property>
<key-property name="creatorId" type="java.lang.Long">
<column name="creator_id" />
</key-property>
</composite-id>
<many-to-one name="video" class="Video" update="false" insert="false" fetch="select" lazy="false">
<column name="video_id" />
</many-to-one>
</class>

Thanks,
Kishore


Top
 Profile  
 
 Post subject: Re: Hibernate search with entity-name
PostPosted: Tue Jun 22, 2010 4:15 am 
Hibernate Team
Hibernate Team

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

the best way wold of be to download the source and see if the patch works. If not you can complete/update it and attach it to the issue. Help like this is highly appreciated. You can also comment on the issue itself get Emmanuel to finish his work.

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.