@Target(value={METHOD,FIELD}) @Retention(value=RUNTIME) public @interface Formula
// perform calculations
@Formula( "sub_total + (sub_total * tax)" )
long getTotalCost() { ... }
// call database functions ( e.g. MySQL upper() and substring() )
@Formula( "upper( substring( middle_name, 1 ) )" )
Character getMiddleInitial() { ... }
// this might be better handled through @ColumnTransformer
@Formula( "decrypt(credit_card_num)" )
String getCreditCardNumber() { ... }
ColumnTransformerpublic abstract String value
Copyright © 2001-2022 Red Hat, Inc. All Rights Reserved.