@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); }
@Override public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { super.contributeTypes( typeContributions, serviceRegistry ); typeContributions.contributeType( new GeolatteGeometryType( PGGeometryTypeDescriptor.INSTANCE ) ); typeContributions.contributeType( new JTSGeometryType( PGGeometryTypeDescriptor.INSTANCE ) ); }
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() ); }
@Override public void contributeTypes(final TypeContributions typeContributions, final ServiceRegistry serviceRegistry) { this.wrapped.contributeTypes(typeContributions, serviceRegistry); }
@Override public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { System.out.println("TypeContributor#contribute"); }