@ Bean public JpaModule jpaModule ( ) { JpaModule module = JpaModule . newServerModule ( em , transactionRunner ) ; // directly expose entity module . addRepository ( JpaRepositoryConfig . builder ( ScheduleEntity . class ) . build ( ) ) ; // additionally expose entity as a mapped dto module . addRepository ( JpaRepositoryConfig . builder ( ScheduleEntity . class , ScheduleDto . class , new ScheduleMapper ( ) ) . build ( ) ) ; JpaCriteriaQueryFactory queryFactory = ( JpaCriteriaQueryFactory ) module . getQueryFactory ( ) ; // register a computed a attribute // you may consider QueryDSL or generating the Criteria query objects. queryFactory . registerComputedAttribute ( ScheduleEntity . class , "upperName" , String . class , new JpaCriteriaExpressionFactory < From < ? , ScheduleEntity > > ( ) { @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ Override public Expression < String > getExpression ( From < ? , ScheduleEntity > entity , CriteriaQuery < ? > query ) { CriteriaBuilder builder = em . getCriteriaBuilder ( ) ; return builder . upper ( ( Expression ) entity . get ( "name" ) ) ; } } ) ; return module ; }
Expose JPA entities as repositories .