Hi All,
I am using hibernate search. I am new to this. When I try to invoke records using this, only the newly created|updated records only getting fetched.
Do I need to add any listeners to hibernate.cfg.xml and persistence.xml?
As if now my hibernate.cfg.xml and persistence.xml looks like this::
persistence.xml<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd"
version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="apptivodb2">
<jta-data-source>java:xaApptivodb2</jta-data-source>
<properties>
<property name="hibernate.ejb.cfgfile"
value="/META-INF/hibernate.cfg.xml" />
<property name="jboss.entity.manager.jndi.name"
value="persistence-units/apptivodb2" />
<property name="hibernate.ejb.event.post-insert"
value="org.hibernate.search.event.FullTextIndexEventListener"/>
<property name="hibernate.ejb.event.post-update"
value="org.hibernate.search.event.FullTextIndexEventListener"/>
<property name="hibernate.ejb.event.post-delete"
value="org.hibernate.search.event.FullTextIndexEventListener"/>
<property name="hibernate.search.default.indexBase" value="/home/skuppusamy/Hibernate/Indexes"/>
</properties>
</persistence-unit>
</persistence>
hibernate.cfg.xml:<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">
org.hibernate.dialect.PostgreSQLDialect
</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">jta</property>
<!-- Enable the second-level cache -->
<!-- Provider is JBoss Cache -->
<!--<property name="cache.provider_class">org.jboss.hibernate.jbc.cacheprovider.JndiBoundTreeCacheProvider</property>-->
<property name="hibernate.cache.jndi">
JndiBoundTreeCacheInstance
</property>
<!-- Transaction factory that supports JTA -->
<property name="transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
<!-- enable caching of entities and collections -->
<property name="cache.use_second_level_cache">true</property>
<!-- enable caching of query results -->
<property name="cache.use_query_cache">true</property>
<property name="cache.region.jbc2.query.localonly">
true
</property>
<!-- JBoss Cache configuration file name -->
<property
name="cache.provider_configuration_file_resource_path">
jboss-cache.xml
</property>
<!-- To use JBoss Cache 2 as your Second Level Cache implementation -->
<property name="cache.region.factory_class">
org.hibernate.cache.jbc2.MultiplexedJBossCacheRegionFactory
</property>
<!-- Use query cache too -->
<property name="cache.use_query_cache">true</property>
<!-- JBoss Transactions Manager lookup class -->
<property name="transaction.manager_lookup_class">
org.hibernate.transaction.TransactionManagerLookup
</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<event type="post-update">
<listener
class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
<event type="post-insert">
<listener
class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
<event type="post-delete">
<listener
class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
</session-factory>
</hibernate-configuration>
Please can anyone help me...?
I am getting the following exception when I added the following properties to hibernate.cfg.xml:
<event type="post-collection-recreate">
<listener
class="org.hibernate.search.event.FullTextIndexCollectionEventListener" />
</event>
<event type="post-collection-remove">
<listener
class="org.hibernate.search.event.FullTextIndexCollectionEventListener" />
</event>
<event type="post-collection-update">
<listener
class="org.hibernate.search.event.FullTextIndexCollectionEventListener"/>
</event>
And the exception is:::Error parsing XML: /META-INF/hibernate.cfg.xml(80) Attribute "type" with value "post-collection-recreate" must have a value from the list "auto-flush merge create create-onflush delete dirty-check evict flush flush-entity load load-collection lock refresh replicate save-update save update pre-load pre-update pre-insert pre-delete post-load post-update post-insert post-delete post-commit-update post-commit-insert post-commit-delete ".
Thanks in Advance,
Sorna.K