jpa 2.0 - Java EE 6 Interceptor for updating JPA 2 Entity after Transaction is finished -


in application develop have hierarchy of objects:

campaignstatus <- campaign -> campaignitem* 

in plain words have campaign has multiple campaignitem's, each campaign has campaignstatus computed based on number of items given campaign has, or on different parameters. long story short, need update campaign status of given campaign, after item related changes saved in db.

in opinion sounds appropriate ground work aspects/ interceptors don't whether practice.

q: it?

q: can trigger interceptor after transaction committed?

  1. no. business requirement should implemented in business layer. make sure updates of campaign made given service, , make service update status accordingly.

  2. you want database in coherent state. campaign , status must updated in same transaction. otherwise, might suceed update campaign , fail update status, leave database in incoherent state. that's transactions about.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -