Steve Ebersole edited a comment on Bug HHH-7580

Design:

  1. phase 1 : the design goal here is to limit class-loading and access to environmental resources which might not yet be available (datasources, jndi,etc)
    1. build BootstrapServiceRegistry - this step is sort of optional and only really needed if user wants to:
      • override how class-loading works
      • supply explicit "provided" Integrator instances
      • override how "strategy selection" works (although can also be done via Java ServiceLoader resolution).
    2. build MetadataSources - this collects the sources of mapping information (HBM files, annotated classes, etc).
  2. phase 2 : at this stage we assume the limits imposed on phase 1 are no longer applicable
    1. build StandardServiceRegistry
    2. build Metadata
    3. use StandardServiceRegistry and Metadata to build SessionFactory

The problem with this is that, from a user PoV, this sure seems like a lot of steps (is that just me?):

// phase 1
BootstrapServiceRegistry bootRegistry = new BootstrapServiceRegistryBuilder()...build();
MetadataSources metadataSources = new MetadataSources( bootRegistry )...;

// phase 2
StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder( bootRegistry )...build();
Metadata metadata = metadataSources.getMetadataBuilder()...buildMetadata( standardRegistry );
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