Package st.orm

Annotation Interface AcceptAdvice


@Target({TYPE,METHOD}) @Retention(RUNTIME) public @interface AcceptAdvice
Accepts advice for the annotated entity, repository, class or method, so the advice log stops reporting it there.

Advice on a statement is accepted when the entity the statement reads or writes accepts it, or when a method or class on the statement's call path does: the service method that issues a query, or a repository interface or one of its methods, including the methods a repository inherits. Advice on a transaction is accepted on the method that runs it, through the proxy Spring puts around a transactional service as well. An entity's own design advice is accepted on the entity. The slow statement log and the performance summary still show accepted advice, labelled accepted:.

Without values, every piece of advice is accepted. With values, only the advice they name is accepted, by the anchor its log line links to, such as page-count in https://orm.st/docs/advice#page-count. A value that names no advice is ignored.


 // The admin export reads every order with its full graph.
 @AcceptAdvice("entity-budget")
 record Order(@PK Integer id, ...) implements Entity<Integer> {}

 interface OrderRepository extends EntityRepository<Order, Integer> {

     // The admin screen shows the total.
     @AcceptAdvice("page-count")
     default Page<Order> adminOrders(Pageable pageable) {
         return select().page(pageable);
     }
 }
 
Since:
1.16
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The anchors of the advice to accept, such as page-count; empty to accept every piece of advice.
  • Element Details

    • value

      String[] value
      The anchors of the advice to accept, such as page-count; empty to accept every piece of advice.
      Returns:
      the anchors of the accepted advice.
      Default:
      {}