Class FailFastJpaConfigValidator
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.jpa.validation.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 ofTrackableBehavior.SANDBOX
orTrackableBehavior.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 Summary
Constructors Constructor Description FailFastJpaConfigValidator(javax.persistence.EntityManager em, com.broadleafcommerce.data.tracking.core.TrackableBehaviorUtil util)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getPhase()
boolean
isAutoStartup()
boolean
isRunning()
void
start()
void
stop()
void
stop(Runnable callback)
protected void
validate(Class<?> javaType, boolean autoConsiderTrackable)
-
-
-
Method Detail
-
start
public void start()
- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
-
validate
protected void validate(Class<?> javaType, boolean autoConsiderTrackable)
-
stop
public void stop()
- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
-
isAutoStartup
public boolean isAutoStartup()
- Specified by:
isAutoStartup
in interfaceorg.springframework.context.SmartLifecycle
-
stop
public void stop(Runnable callback)
- Specified by:
stop
in interfaceorg.springframework.context.SmartLifecycle
-
getPhase
public int getPhase()
- Specified by:
getPhase
in interfaceorg.springframework.context.Phased
- Specified by:
getPhase
in interfaceorg.springframework.context.SmartLifecycle
-
-