Class FailFastJpaConfigValidator

  • All Implemented Interfaces:
    org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

    public class FailFastJpaConfigValidator
    extends Object
    implements org.springframework.context.SmartLifecycle
    Validation class that runs at system startup and determines if there are any JPA entity configuration problems detected with entity classes registered with Spring Data. The primary check is to determine if there are any @OneToOne or @ManyToOne relationships declared from a @Trackable entity (with behavior of TrackableBehavior.SANDBOX or TrackableBehavior.CATALOG) to another @Trackable entity with similar behavior. This type of relationship is not allowed, as those types of combinations cannot be effectively narrowed.
    • Constructor Detail

      • FailFastJpaConfigValidator

        public FailFastJpaConfigValidator​(javax.persistence.EntityManager em,
                                          com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil util)
    • Method Detail

      • start

        public void start()
        Specified by:
        start in interface org.springframework.context.Lifecycle
      • validate

        protected void validate​(Class<?> javaType,
                                boolean autoConsiderTrackable)
      • stop

        public void stop()
        Specified by:
        stop in interface org.springframework.context.Lifecycle
      • isRunning

        public boolean isRunning()
        Specified by:
        isRunning in interface org.springframework.context.Lifecycle
      • isAutoStartup

        public boolean isAutoStartup()
        Specified by:
        isAutoStartup in interface org.springframework.context.SmartLifecycle
      • stop

        public void stop​(Runnable callback)
        Specified by:
        stop in interface org.springframework.context.SmartLifecycle
      • getPhase

        public int getPhase()
        Specified by:
        getPhase in interface org.springframework.context.Phased
        Specified by:
        getPhase in interface org.springframework.context.SmartLifecycle