Annotation Interface JpaEntityScan


@Retention(RUNTIME) @Target(TYPE) @Documented @Import(JpaEntityScanBeanRegistrar.class) public @interface JpaEntityScan
Similar to EntityScan, but allows for tying the scanned entities to a particular route for use with JpaDataRoute and RoutingJpaDataSource. It is expected that the routePackage() values matches that of JpaDataRoute.routePackage(). The end result is that one or more entities will be tied to a particular datasource, thereby limiting the scope to a specific backing datastore or database partition.
Author:
Jeff Fischer
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    One or more packages to scan for valid JPA annotated entities.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    since 3.0.0.
    The portion of a package name that uniquely identifies this route.
    boolean
    Controls whether the registrar should skip trying to automatically infer the route package.
  • Element Details

    • basePackages

      String[] basePackages
      One or more packages to scan for valid JPA annotated entities.
      Returns:
      One or more packages to scan for valid JPA annotated entities.
    • routePackage

      String routePackage
      The portion of a package name that uniquely identifies this route. For example, the Broadleaf offer service exposes a package com.broadleafcommerce.promotion.offer that uniquely belongs to all classes in the offer service. This can be left blank, in which case, the domain classes in the basePackages will be reviewed for extensions of out-of-the-box domain by which the routePackage may be deduced. Failing that, all scanned entities in the basePackages() will be included in all EntityManagerFactory instances.
      Returns:
      The portion of a package name that uniquely identifies this route.
      Default:
      ""
    • skipRouteInference

      @AliasFor("includeInAllRoutesIfRoutePackageEmpty") boolean skipRouteInference
      Controls whether the registrar should skip trying to automatically infer the route package.

      If true, the system skips automatic detection of a route package via entity extension hierarchy and assigns these entities to ALL routes immediately. This is useful for shared utility classes or JPA converters.

      If false (default), the registrar will attempt to automatically infer a route package. If no extension route is detected, it will fall back to assigning to all routes and log a warning.

      Returns:
      true if route inference should be bypassed.
      Default:
      false
    • includeInAllRoutesIfRoutePackageEmpty

      @Deprecated(since="3.0.0", forRemoval=true) @AliasFor("skipRouteInference") boolean includeInAllRoutesIfRoutePackageEmpty
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 3.0.0. Use skipRouteInference() instead.
      If routePackage() is left empty and skipRouteInference is set to false, the system will normally try to infer a route package. If a route is not identified, then it will default to including the scanned entities in all routes.

      If skipRouteInference is set to true, the system will skip that step and automatically include the scanned entities in all routes. The default is false.

      Returns:
      Whether to include scanned entities in all routes if routePackage() is empty.
      Default:
      false