Scott brought up a good general idea on the developer list...
We could hide some of this verbosity for cases where the 2 phase is not needed. I think what we lose there is a little bit of the "directedness" of the API. That or introduce a new API for the non-verbose-needing cases.
The simplest case is:
build StandardServiceRegistry
build MetadataSources
build SessionFactory
essentially what we had before the 2-phase break. The idea would be that building StandardServiceRegistry would need to internally build a BootstrapServiceRegistry. That StandardServiceRegistry could then be passed along to MetadataSources. So we'd have a couple of usages:
TheSimplestUseCase.java
StandardServiceRegistry registry = new StandardServiceRegistryBuilder()...build();
MetadataSources metadataSources = new MetadataSources( registry )...;
SessionFactory sessionFactory = metadataSources.buildMetadata().buildSessionFactory();
StillSimpleOnePhaseUseCase.java
BootstrapServiceRegistry bootRegistry = new BootstrapServiceRegistryBuilder()...build();
StandardServiceRegistry registry = new StandardServiceRegistryBuilder( bootRegistry )...build();
MetadataSources metadataSources = new MetadataSources( registry )...;
SessionFactory sessionFactory = metadataSources.buildMetadata().buildSessionFactory();
SimpleTwoPhaseUseCase.java
BootstrapServiceRegistry bootRegistry = new BootstrapServiceRegistryBuilder()...build();
MetadataSources metadataSources = new MetadataSources( bootRegistry )...;
StandardServiceRegistry registry = new StandardServiceRegistryBuilder( bootRegistry )...build();
SessionFactory sessionFactory = metadataSources.buildMetadata( registry ).buildSessionFactory();
FullTwoPhaseUseCase.java
BootstrapServiceRegistry bootRegistry = new BootstrapServiceRegistryBuilder()...build();
MetadataSources metadataSources = new MetadataSources( bootRegistry )...;
StandardServiceRegistry registry = new StandardServiceRegistryBuilder( bootRegistry )...build();
Metadata metadata = metadataSources.getMetadataBuilder( registry )...build();
SessionFactory sessionFactory = metadata.getSessionFactoryBuilder()...build();
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Scott brought up a good general idea on the developer list...
We could hide some of this verbosity for cases where the 2 phase is not needed. I think what we lose there is a little bit of the "directedness" of the API. That or introduce a new API for the non-verbose-needing cases.
The simplest case is:
essentially what we had before the 2-phase break. The idea would be that building StandardServiceRegistry would need to internally build a BootstrapServiceRegistry. That StandardServiceRegistry could then be passed along to MetadataSources. So we'd have a couple of usages: