java - Persisting entities to both database and search engine -
i creating application use jpa , elasticsearch. have question on how structure , hook them together. have entity named newspaper
.
i want persist in database , index in search engine. now, approach that? inject search repository layer news paper repository use jpa , index after persisting it?
would create service layer , have service bean class first persist database index using repositories? or can done in other (better) ways?
here did in former job:
in service layer, after persisting entity hibernate, transform entity using jackson , send elasticsearch. of course, can in repo layer (dao layer) don't much.
by way, if using spring, have @ spring factory project elasticsearch.
Comments
Post a Comment