org.hibernate.boot.model.TypeContributions Java Examples
The following examples show how to use
org.hibernate.boot.model.TypeContributions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Oracle12cDialect.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { super.contributeTypes( typeContributions, serviceRegistry ); // account for Oracle's deprecated support for LONGVARBINARY... // prefer BLOB, unless the user opts out of it boolean preferLong = serviceRegistry.getService( ConfigurationService.class ).getSetting( PREFER_LONG_RAW, StandardConverters.BOOLEAN, false ); if ( !preferLong ) { typeContributions.contributeType( MaterializedBlobType.INSTANCE, "byte[]", byte[].class.getName() ); typeContributions.contributeType( WrappedMaterializedBlobType.INSTANCE, "Byte[]", Byte[].class.getName() ); } }
Example #2
Source File: PostgreSQLJsonBinaryTypeProgrammaticConfigurationTest.java From hibernate-types with Apache License 2.0 | 6 votes |
@Override protected void additionalProperties(Properties properties) { CustomObjectMapperSupplier customObjectMapperSupplier = new CustomObjectMapperSupplier(); final JsonBinaryType jsonBinaryType = new JsonBinaryType(customObjectMapperSupplier.get(), Location.class); properties.put( "hibernate.type_contributors", new TypeContributorList() { @Override public List<TypeContributor> getTypeContributors() { List<TypeContributor> typeContributors = new ArrayList<TypeContributor>(); typeContributors.add(new TypeContributor() { @Override public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { typeContributions.contributeType( jsonBinaryType, "location" ); } }); return typeContributors; } }); }
Example #3
Source File: PostgreSQL82Dialect.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { super.contributeTypes( typeContributions, serviceRegistry ); // HHH-9562 typeContributions.contributeType( PostgresUUIDType.INSTANCE ); }
Example #4
Source File: NomulusPostgreSQLDialect.java From nomulus with Apache License 2.0 | 5 votes |
@Override public void contributeTypes( TypeContributions typeContributions, ServiceRegistry serviceRegistry) { super.contributeTypes(typeContributions, serviceRegistry); typeContributions.contributeJavaTypeDescriptor(StringCollectionDescriptor.getInstance()); typeContributions.contributeSqlTypeDescriptor(StringCollectionDescriptor.getInstance()); typeContributions.contributeJavaTypeDescriptor(StringMapDescriptor.getInstance()); typeContributions.contributeSqlTypeDescriptor(StringMapDescriptor.getInstance()); }
Example #5
Source File: MetadataContributorsJsonNodeBinaryTypeFetchTest.java From high-performance-java-persistence with Apache License 2.0 | 5 votes |
@Override protected void additionalProperties(Properties properties) { TypeContributor typeContributor = new TypeContributor() { @Override public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { typeContributions.contributeType(JsonNodeBinaryType.INSTANCE); typeContributions.contributeSqlTypeDescriptor(JsonNodeBinaryType.INSTANCE .getSqlTypeDescriptor()); } }; properties.put( "hibernate.type_contributors", (TypeContributorList) () -> Collections.singletonList(typeContributor) ); }
Example #6
Source File: ReactiveTypeContributor.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { if ( ReactiveModeCheck.isReactiveRegistry( serviceRegistry ) ) { registerReactiveChanges( typeContributions, serviceRegistry ); } }
Example #7
Source File: ReactiveTypeContributor.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 4 votes |
private void registerReactiveChanges(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { BasicTypeRegistry basicTypeRegistry = typeContributions.getTypeConfiguration().getBasicTypeRegistry(); Dialect dialect = serviceRegistry.getService(JdbcEnvironment.class).getDialect(); basicTypeRegistry.register( new BlobType(dialect) ); basicTypeRegistry.register( new ClobType(dialect) ); }
Example #8
Source File: AbstractTest.java From hibernate-types with Apache License 2.0 | 4 votes |
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() ); }
Example #9
Source File: TestTypeContributor.java From hibernate-demos with Apache License 2.0 | 4 votes |
@Override public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { System.out.println("TypeContributor#contribute"); }
Example #10
Source File: TestTypeContributor.java From hibernate-demos with Apache License 2.0 | 4 votes |
@Override public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { System.out.println("TypeContributor#contribute"); }
Example #11
Source File: DelegatingDialect.java From keycloak with Apache License 2.0 | 4 votes |
@Override public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) { getInstance().contributeTypes(typeContributions, serviceRegistry); }
Example #12
Source File: Dialect.java From lams with GNU General Public License v2.0 | 2 votes |
/** * 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) { resolveLegacyLimitHandlerBehavior( serviceRegistry ); }