solr - Solrj server in EJB 3 container -
using jboss eap 6.1 , solr 4.5
how people interact solr (via solrj) in ejb container? people create managed bean wrapping solrserver implementation? how many instances or singleton (queuing commits , forth)? contemplating using embedded server adds in thread-safety considerations.
have gone far jca adapter?
the best way using hibernatesearch in jpa layer.
you need implement own solr worker backend, can find example here: hibernatesearchsolrworkerbackend
in solr worker backend use solrj, , after annotate entities hibernatesearch annotation interact automatically solr after each transaction commited. indexes date.
you can take @ entire example have idea on how implement hibernate_search_solr_integration
in above project find complete spring example. if want use plane jpa objects need have in persistence.xml
<?xml version="1.0" encoding="utf-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/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/persistence_2_0.xsd"> <persistence-unit name="espn-mediacatalog"> <jta-data-source>java:jboss/datasources/your-datasourceds</jta-data-source> <properties> <property name="hibernate.search.default.worker.backend" value="com.xxx.xxproject.jpa.solr.hibernatesearchsolrworkerbackend" /> <property name="hibernate.search.default.directory_provider" value="org.hibernate.search.store.impl.ramdirectoryprovider" /> </properties> </persistence-unit>
cheers!
Comments
Post a Comment