Thanks for your help.
I am storing one entity that I can retrieve successfully by a
EntityManager.find() call.
My test case is:
Code:
@Entity
@Indexed
public class A {
@Id
@Column(name = "ID")
@DocumentId
private/* final */String id;
@Column(name = "DESC")
private String desc;
public A(){}
public A(String id, String desc){
this.id = id;
this.desc = desc;
}
}
Code:
public class TestCase {
public static void main(String[] args) throws Exception {
EntityManager em;
EntityManagerFactory f = Persistence.createEntityManagerFactory("MyTestCase");
A a = new A("id", "desc");
EntityManager em = f.createEntityManager();
EntityTransaction t = em.getTransaction();
t.begin();
em.persist(a);
t.commit();
em.close();
em = f.createEntityManager();
t = em.getTransaction();
t.begin();
A findItem= em.find(A.class, "id");
System.out.println("Item: " + findItem);
t.commit();
em.close();
em = f.createEntityManager();
Session session = (org.hibernate.Session)em.getDelegate();
final FullTextSession fullTextSession = Search.getFullTextSession( session );
final FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(new MatchAllDocsQuery(), A.class);
List<A> result = (List<A>) fullTextQuery.list();
System.out.println("Query result size: " + result.size());
}
Code:
<persistence-unit name="MyTestCase">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<class>com.swingws.pav.core.impl.model.A</class>
<properties>
<property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory" />
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform" />
<property name="hibernate.ogm.datastore.provider" value="infinispan" />
<property name="hibernate.ogm.datastore.grid_dialect" value="org.hibernate.ogm.dialect.infinispan.InfinispanDialect" />
<property name="hibernate.search.default.directory_provider" value="filesystem" />
<property name="hibernate.search.default.indexBase" value="lucene/indexes" />
<property name="hibernate.search.Rules.directory_provider" value="ram" />
<property name="hibernate.search.Actions.directory_provider" value="com.acme.hibernate.CustomDirectoryProvider" />
</properties>
</persistence-unit>