Java 类org.hibernate.metamodel.spi.TypeContributions 实例源码

项目:xmltype-jpa    文件:H2OracleXmlDialect.java   
private void registerTypes(final TypeContributions typeContributions) {
    typeContributions.contributeType(new OrderUserType() {

        @Override
        public void nullSafeSet(final PreparedStatement statement, final Object value, final int index, final SessionImplementor session) throws SQLException {
            try {
                statement.setObject(index, jaxbToString(value));
            } catch (JAXBException e) {
                throw new SQLException("Could not set test Order", e);
            }
        }
    }, new String[]{"Order"});
}
项目:xmltype-jpa    文件:H2OracleXmlDialect.java   
private void registerTypes(final TypeContributions typeContributions) {
    typeContributions.contributeType(new OrderUserType() {

        @Override
        public void nullSafeSet(final PreparedStatement statement, final Object value, final int index, final SessionImplementor session) throws SQLException {
            try {
                statement.setObject(index, jaxbToString(value));
            } catch (JAXBException e) {
                throw new SQLException("Could not set test Order", e);
            }
        }
    }, new String[]{"Order"});
}
项目:hibernate-types    文件:AbstractTest.java   
private SessionFactory newSessionFactory() {
    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, new String[]{type.getName()});
                    } else if (type instanceof CompositeUserType) {
                        typeContributions.contributeType((CompositeUserType) type, new String[]{type.getName()});
                    }
                }
            }
        });
    }
    return configuration.buildSessionFactory(
            new StandardServiceRegistryBuilder()
                    .applySettings(properties)
                    .build()
    );
}
项目:xmltype-jpa    文件:OracleXmlDialect.java   
@Override
public void contributeTypes(final TypeContributions typeContributions,
                            final ServiceRegistry serviceRegistry) {
    super.contributeTypes(typeContributions, serviceRegistry);
    registerTypes(typeContributions);
}
项目:xmltype-jpa    文件:OracleXmlDialect.java   
private void registerTypes(final TypeContributions typeContributions) {
    typeContributions.contributeType(new OrderUserType(), new String[]{"Order"});
}
项目:xmltype-jpa    文件:H2OracleXmlDialect.java   
@Override
public void contributeTypes(final TypeContributions typeContributions,
        final ServiceRegistry serviceRegistry) {
    super.contributeTypes(typeContributions, serviceRegistry);
    registerTypes(typeContributions);
}
项目:xmltype-jpa    文件:OracleXmlDialect.java   
@Override
public void contributeTypes(final TypeContributions typeContributions,
                            final ServiceRegistry serviceRegistry) {
    super.contributeTypes(typeContributions, serviceRegistry);
    registerTypes(typeContributions);
}
项目:xmltype-jpa    文件:OracleXmlDialect.java   
private void registerTypes(final TypeContributions typeContributions) {
    typeContributions.contributeType(new OrderUserType(), new String[]{"Order"});
}
项目:xmltype-jpa    文件:H2OracleXmlDialect.java   
@Override
public void contributeTypes(final TypeContributions typeContributions,
        final ServiceRegistry serviceRegistry) {
    super.contributeTypes(typeContributions, serviceRegistry);
    registerTypes(typeContributions);
}
项目:lams    文件:Dialect.java   
/**
 * Allows the Dialect to contribute additional types
 *
 * @param typeContributions Callback to contribute the types
 * @param serviceRegistry The service registry
 */
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
    // by default, nothing to do
}