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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -