|
Another concern here is the delayed access to resources in JPA EE bootstrapping, specifically:
-
CDI BeanManager
-
BV ValidatorFactory
-
DataSource
BeanManager is easy to handle because we really dont need the BeanManager instance until building the SessionFactory.
We can live without the ValidatorFactory so long as the user is not requesting DB constraints for the validations.
DataSource is a tough one because of how we changed metamodel to leverage database-specific info during binding. Just need to make sure that metamodel binding works ok if a JDBC Connection is not available.
One thought here is to specify a contract like:
public interface DelayedAccessResources {
Object getBeanManagerInstance() throws NotYetAccessibleException;
Object getValidatorFactory() throws NotYetAccessibleException;
DataSource getDataSource() throws NotYetAccessibleException;
}
The idea would be that the EntityManagerFactoryBuilder would register an instance of this with the service registry or SessionFactoryBuilder.
|