@Override public NamedQueryRepository buildNamedQueryRepository(SessionFactoryImpl sessionFactory) { return new NamedQueryRepository( namedQueryMap, namedNativeQueryMap, sqlResultSetMappingMap, buildProcedureCallMementos( sessionFactory ) ); }
@Override public void validate() throws MappingException { for ( PersistentClass entityBinding : this.getEntityBindings() ) { entityBinding.validate( this ); } for ( Collection collectionBinding : this.getCollectionBindings() ) { collectionBinding.validate( this ); } }
@Override public SessionFactory buildSessionFactory() { return getSessionFactoryBuilder().build(); }
@Override public NamedQueryRepository buildNamedQueryRepository(SessionFactoryImplementor sessionFactory) { return new NamedQueryRepositoryImpl( buildNamedHqlDescriptorMap( sessionFactory ), buildNamedNativeDescriptorMap( sessionFactory ), buildProcedureCallMementos( sessionFactory ), buildSqlResultSetMappings( sessionFactory ) ); }
try { Metadata metadata = new MetadataSources( ssr ).addAnnotatedClass( TheEntity.class ).buildMetadata(); ( (MetadataImpl) metadata ).validate();
@Override public void validate() throws MappingException { for ( EntityMapping entityBinding : getEntityMappings() ) { ((EntityMappingImplementor)entityBinding).validate(); } for ( Collection collectionBinding : this.getCollectionBindings() ) { collectionBinding.validate(); } }
return new MetadataImpl( uuid, options,
MetadataImpl metadata = metadataCollector .buildMetadataInstance(metadataBuildingContext); metadata.getTypeConfiguration().scope(metadataBuildingContext); JdbcBinder binder = new JdbcBinder( serviceRegistry,
@Override public java.util.Collection<Table> collectTableMappings() { return collectMappedTableMappings().stream().map( t -> (Table) t ).collect( Collectors.toList() ); }
@Test @TestForIssue( jiraKey = "HHH-9042" ) public void testMetamodelBuilding() { StandardServiceRegistry ssr = new StandardServiceRegistryBuilder() .applySetting( AvailableSettings.HBM2DDL_AUTO, "create-drop" ) .build(); try { Metadata metadata = new MetadataSources( ssr ) .addAnnotatedClass( Person.class ) .getMetadataBuilder() .applyAttributeConverter( SexConverter.class ) .build(); ( (MetadataImpl) metadata ).validate(); PersistentClass personBinding = metadata.getEntityBinding( Person.class.getName() ); assertNotNull( personBinding ); PersistentClass personAuditBinding = metadata.getEntityBinding( Person.class.getName() + "_AUD" ); assertNotNull( personAuditBinding ); } finally { StandardServiceRegistryBuilder.destroy( ssr ); } } }
return new MetadataImpl( uuid, options,
MetadataImpl metadata = metadataCollector .buildMetadataInstance(metadataBuildingContext); metadata.getTypeConfiguration().scope(metadataBuildingContext); JDBCBinder binder = new JDBCBinder( serviceRegistry,
@Test @TestForIssue( jiraKey = "HHH-9599") public void basicTest() { StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build(); try { Metadata metadata = new MetadataSources( ssr ).addAnnotatedClass( TestEntity.class ).buildMetadata(); ( (MetadataImpl) metadata ).validate(); final PersistentClass entityBinding = metadata.getEntityBinding( TestEntity.class.getName() ); if(metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect || metadata.getDatabase().getDialect() instanceof DB2Dialect){ // See issue HHH-10693 for PostgreSQL, HHH-12753 for DB2 assertEquals( Types.VARCHAR, entityBinding.getProperty( "name" ).getType().sqlTypes( metadata )[0] ); }else { assertEquals( Types.NVARCHAR, entityBinding.getProperty( "name" ).getType().sqlTypes( metadata )[0] ); } } finally { StandardServiceRegistryBuilder.destroy( ssr ); } }
@Override public SessionFactory buildSessionFactory() { return getSessionFactoryBuilder().build(); }