Hibernate version:
hibernate 3.3.1.ga
hibernate-annotations-3.4.0.ga
hibernate-commons-annotations-3.1.0.ga
hibernate-search-3.1.0.ga
hibernate-tools-3.2.4.CR2
lucene-core-2.4.0.jar
data source #1 - using lucene indexing :
Code:
<jee:jndi-lookup id="core.dataSource" jndi name="jdbc/coreJdbcPool" />
<bean id="core.sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" >
<property name="dataSource" ref="core.dataSource" />
<property name="packagesToScan" value="com.chaos.core.model"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${core_serverapp.hibernate.dialect}</prop>
<!--
enable 2nd level cache - ehcache
-->
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">com/chaos/core/ehcache-dao.xml</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cache.use_structured_entries">true</prop>
<!--<prop key="hibernate.hbm2ddl.auto">update</prop>-->
<!-- lucene -->
<prop key="hibernate.search.default.indexBase">${core_serverapp.lucene.indexBase}</prop>
<prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>
<!-- To disable indexing uncomment the listeners line below. Note that there is no performance runtime when the listeners
are enabled while no entity is indexable. -->
<!-- <prop key="hibernate.search.autoregister_listeners">false</prop> -->
</props>
</property>
<!-- lucene event listeners -->
<property name="eventListeners">
<map>
<entry key="post-update">
<set>
<bean class="org.hibernate.search.event.FullTextIndexEventListener"/>
<bean class="com.chaos.core.service.notification.NotificationEventListener"/>
</set>
</entry>
<entry key="post-insert">
<set>
<bean class="org.hibernate.search.event.FullTextIndexEventListener"/>
<bean class="com.chaos.core.service.notification.NotificationEventListener"/>
</set>
</entry>
<entry key="post-delete">
<set>
<bean class="org.hibernate.search.event.FullTextIndexEventListener"/>
<bean class="com.chaos.core.service.notification.NotificationEventListener"/>
</set>
</entry>
<entry key="post-collection-recreate">
<set>
<bean class="org.hibernate.search.event.FullTextIndexEventListener"/>
</set>
</entry>
<entry key="post-collection-remove">
<set>
<bean class="org.hibernate.search.event.FullTextIndexEventListener"/>
</set>
</entry>
<entry key="post-collection-update">
<set>
<set>
<bean class="org.hibernate.search.event.FullTextIndexEventListener"/>
</set>
</entry>
</map>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="allowCustomIsolationLevels" value="true" />
</bean>
edit 2/18 7:18am est
@Indexed
@Analyzer(impl = EnglishSnowballAnalyzer.class)
@Entity
@Table(name = "assets")
@org.hibernate.annotations.Entity(dynamicInsert=true, dynamicUpdate = true)
@Cache(usage = CacheConcurencyStrategy.READ_WRITE)
public class Asset implements java.io.Serializable {
@DocmentId
@Id
@GeneratedValue
@Column(name = "ID", nullable = false)
private long id;
@IndexedEmbedded
@OneToMany(cascade = {}, fetch = FetchType.LAZY, mappedBy = "asset")
private List<GatekeeperActivity> gatekeeperActivityList = new ArrayList<GatekeeperActivity>(0);
.
.
.
}
@Entity
@Table(name = "gatekeeper_acitvity")
@Analyzer(impl = EnglishSnowballAnalyzer.class)
@org.hibernate.annotations.Entity(dynamicInsert=true, dynamicUpdate=true)
@Cache(usage = CacheConcurrentyStratedy.READ_WRITE)
public class GetekeeperActivity implements java.io.Serializable) {
@DocumentId
@Id
@GeneratedValue
@Column(name = "id", nullable = false)
private long id;
@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
@JoinCoumn(name = "asset_id", nullable=false)
@ForeignKey(name="fk_asset_id_gk")
private Asset asset;
}
data source #2 - no indexed entities Code:
<jee:jndi-lookup id="bserver.dataSource" jndi-name="jdbc/bJdbcPool" />
<bean id="bserver.sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="bserver.dataSource" />
<property name="configLocation" value="classpath:com/chaos/bmam/hibernate.cfg.xml" />
<property name="annotatedClasses">
<list>
<value>com.chaos.core.model.BaseConfig</value>
<value>com.chaos.core.model.ConfigParam</value>
<value>com.chaos.core.model.MediaManagerConfig</value>
<value>com.chaos.core.model.ServerConfig</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${bserverapp.hibernate.dialect}</prop>
<!--
enable 2nd level cache - ehcache
-->
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">com/chaos/bmam/ehcache-dao.xml</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cache.use_structured_entries">true</prop>
</props>
</property>
</bean>
<!--
Transaction Manager
-->
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="allowCustomIsolationLevels" value="true" />
</bean>
Name and version of the database you are using:mysql 5.0.45
Glassfish Sun Java System Application Server 9.1_02 (build b04-fcs)Manual indexing works just fine without annotated classes. However when I persist something the lucene index is not being updated. I verify this with Luke. Also our web app does a manual index upon start and that works
only if I blow away the lucene index directory. ie if I add 10 entities to the db, the lucene index is never updated until I stop the webapp, blow away the index and let it start back up which triggers our app to do manual indexing.
I have debugged the hibernate-search code and I can see the FullTextIndexEventListener code being called. It then calls TransactionalWorker.performWork(work, context) which determines that a transaction is in progress and calls txSync.add( work ); I have also traced this down through BatchedQueueingProcessor .add( work, queue) and it's calling workQueue.add( work ) just fine.
We are using XA transactions because we are talking to two databases as well as a jms queue. There are no exceptions in the logs when I persist an entity and it's adding to the work queue.
I also turned on trace using
Code:
log4j.logger.org.hibernate.search=TRACE
but I only see this small amount during startup:
Code:
2009-02-16 16:06:44,594 [pool-1-thread-4] TRACE (org.hibernate.search.backend.configuration.MaskedProperty#getProperty:79) - found a match for key: [hibernate.search.default.directory_provider] value: org.hibernate.search.store.FSDirectoryProvider
2009-02-16 16:06:44,596 [pool-1-thread-4] TRACE (org.hibernate.search.backend.configuration.MaskedProperty#getProperty:79) - found a match for key: [default.directory_provider] value: org.hibernate.search.store.FSDirectoryProvider
2009-02-16 16:06:44,609 [pool-1-thread-4] TRACE (org.hibernate.search.backend.configuration.MaskedProperty#getProperty:79) - found a match for key: [hibernate.search.default.indexBase] value: /bmam/lucene
2009-02-16 16:06:44,611 [pool-1-thread-4] TRACE (org.hibernate.search.backend.configuration.MaskedProperty#getProperty:79) - found a match for key: [default.indexBase] value: /bmam/lucene
edit I do however see trace when I blow away the index and let it recreate on start via manual indexing:
Code:
009-02-16 16:30:36,281 [pool-5-thread-1] TRACE (org.hibernate.search.backend.impl.lucene.works.AddWorkDelegate#performWork:53) - add to Lucene index: class com.chaos.core.model.Asset .....