Java 类org.hibernate.boot.model.TypeContributions 实例源码

项目:hibernate-json-type    文件:JsonTypeContributor.java   
@Override
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
    JsonType jtype;
    JavaTypeDescriptor jdesc;
    try {
        jtype = JsonType.INSTANCE;
        jdesc = JsonJavaTypeDescriptor.INSTANCE;
    }
    catch (Throwable t) {
        // Avoid logging system for a project so small
        System.err.println("JSON type contribution failed! Message: " + t.getMessage());
        t.printStackTrace(System.err);
        return;
    }
    JavaTypeDescriptorRegistry.INSTANCE.addDescriptor(jdesc);
    typeContributions.contributeType(jtype);
}
项目:ARCLib    文件:PostgreSQL94SpatialDialect.java   
@Override
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
    super.contributeTypes(
            typeContributions,
            serviceRegistry
    );

    typeContributions.contributeType( new GeolatteGeometryType( PGGeometryTypeDescriptor.INSTANCE ) );
    typeContributions.contributeType( new JTSGeometryType( PGGeometryTypeDescriptor.INSTANCE ) );
}
项目:hibernate-types    文件:AbstractTest.java   
private SessionFactory newLegacySessionFactory() {
    Properties properties = properties();
    Configuration configuration = new Configuration().addProperties(properties);
    for (Class<?> entityClass : entities()) {
        configuration.addAnnotatedClass(entityClass);
    }
    String[] packages = packages();
    if (packages != null) {
        for (String scannedPackage : packages) {
            configuration.addPackage(scannedPackage);
        }
    }
    String[] resources = resources();
    if (resources != null) {
        for (String resource : resources) {
            configuration.addResource(resource);
        }
    }
    Interceptor interceptor = interceptor();
    if (interceptor != null) {
        configuration.setInterceptor(interceptor);
    }

    final List<Type> additionalTypes = additionalTypes();
    if (additionalTypes != null) {
        configuration.registerTypeContributor(new TypeContributor() {
            @Override
            public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
                for (Type type : additionalTypes) {
                    if (type instanceof BasicType) {
                        typeContributions.contributeType((BasicType) type);
                    } else if (type instanceof UserType) {
                        typeContributions.contributeType((UserType) type);
                    } else if (type instanceof CompositeUserType) {
                        typeContributions.contributeType((CompositeUserType) type);
                    }
                }
            }
        });
    }
    return configuration.buildSessionFactory(
            new StandardServiceRegistryBuilder()
                    .applySettings(properties)
                    .build()
    );
}
项目:org.fastnate    文件:AllowMissingIdentitySupportDialect.java   
@Override
public void contributeTypes(final TypeContributions typeContributions, final ServiceRegistry serviceRegistry) {
    this.wrapped.contributeTypes(typeContributions, serviceRegistry);
}
项目:hibernate-demos    文件:TestTypeContributor.java   
@Override
   public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
    System.out.println("TypeContributor#contribute");
}
项目:hibernate-demos    文件:TestTypeContributor.java   
@Override
   public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
    System.out.println("TypeContributor#contribute");
}