List of usage examples for org.hibernate.cfg Configuration registerTypeOverride
public Configuration registerTypeOverride(CompositeUserType type, String[] keys)
From source file:com.flipkart.flux.guice.module.HibernateModule.java
License:Apache License
/** * Adds annotated classes and custom types to passed Hibernate configuration. *///from w w w .j av a2 s. c om private void addAnnotatedClassesAndTypes(Configuration configuration) { //register hibernate custom types configuration.registerTypeOverride(new BlobType(), new String[] { "BlobType" }); configuration.registerTypeOverride(new StoreFQNType(), new String[] { "StoreFQNOnly" }); configuration.registerTypeOverride(new ListJsonType(), new String[] { "ListJsonType" }); //add annotated classes to configuration configuration.addAnnotatedClass(AuditRecord.class); configuration.addAnnotatedClass(Event.class); configuration.addAnnotatedClass(State.class); configuration.addAnnotatedClass(StateMachine.class); }
From source file:net.derquinse.common.orm.hib.Configurations.java
License:Apache License
private static void registerTypes(Configuration configuration, UserType... types) { for (UserType type : types) { String name = type.returnedClass().getName(); configuration.registerTypeOverride(type, new String[] { name }); }//from w ww . j av a 2 s. c o m }
From source file:net.derquinse.common.orm.hib.Configurations.java
License:Apache License
@SuppressWarnings("unused") private static void registerTypes(Configuration configuration, CompositeUserType... types) { for (CompositeUserType type : types) { String name = type.returnedClass().getName(); configuration.registerTypeOverride(type, new String[] { name }); }//from w ww . j ava 2s . c om }
From source file:org.jadira.usertype.spi.shared.AbstractUserTypeHibernateIntegrator.java
License:Apache License
private void registerType(Configuration configuration, CompositeUserType type) { String className = type.returnedClass().getName(); configuration.registerTypeOverride(type, new String[] { className }); }
From source file:org.jadira.usertype.spi.shared.AbstractUserTypeHibernateIntegrator.java
License:Apache License
private void registerType(Configuration configuration, UserType type) { String className = type.returnedClass().getName(); configuration.registerTypeOverride(type, new String[] { className }); }
From source file:org.kalypso.model.wspm.pdb.internal.connect.HibernateConnection.java
License:Open Source License
private void configureSpatial(final Configuration configuration) { /**//from w w w . ja v a2 s . co m * IMPORTANT: statically initialize HBSpatialExtension at this place (with the right context class loader active, so * the pseudo DialectProvider will be found; we will get a NPE else later. */ HBSpatialExtension.getDefaultGeomFactory(); /** * Important: we need to specify the spatial dialect ourself, else hibernatespatial will fall back to a default * spatial dialect. */ final SpatialDialect spatialDialect = createSpatialDialect(); final GeometryUserType2 geometryUserType = new GeometryUserType2(spatialDialect); configuration.registerTypeOverride(geometryUserType, new String[] { geometryUserType.getClass().getName() }); configuration.setProperty(Environment.DIALECT, spatialDialect.getClass().getName()); configuration.setProperty(SPATIAL_DIALECT, spatialDialect.getClass().getName()); }
From source file:org.n52.sos.config.sqlite.SQLiteSessionFactory.java
License:Open Source License
private SessionFactory createSessionFactory(Properties properties) { Configuration cfg = new Configuration().addAnnotatedClass(BooleanSettingValue.class) .addAnnotatedClass(FileSettingValue.class).addAnnotatedClass(IntegerSettingValue.class) .addAnnotatedClass(NumericSettingValue.class).addAnnotatedClass(StringSettingValue.class) .addAnnotatedClass(UriSettingValue.class).addAnnotatedClass(ChoiceSettingValue.class) .addAnnotatedClass(AdminUser.class).addAnnotatedClass(CapabilitiesExtensionImpl.class) .addAnnotatedClass(OfferingExtensionImpl.class).addAnnotatedClass(StaticCapabilitiesImpl.class) .addAnnotatedClass(Operation.class).addAnnotatedClass(ProcedureEncoding.class) .addAnnotatedClass(Binding.class).addAnnotatedClass(ObservationEncoding.class) .addAnnotatedClass(DynamicOfferingExtension.class) .addAnnotatedClass(DynamicOwsExtendedCapabilities.class) .addAnnotatedClass(TimeInstantSettingValue.class) .addAnnotatedClass(MultilingualStringSettingValue.class); cfg.registerTypeOverride(new HibernateFileType(), new String[] { "file", File.class.getName() }); cfg.registerTypeOverride(new HibernateUriType(), new String[] { "uri", URI.class.getName() }); cfg.registerTypeOverride(new HibernateTimeInstantType(), new String[] { "timeInstant", TimeInstant.class.getName() }); if (properties != null) { cfg.mergeProperties(properties); }/* ww w. j ava2 s .com*/ cfg.mergeProperties(defaultProperties); ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()) .build(); return cfg.buildSessionFactory(serviceRegistry); }
From source file:org.openeos.hibernate.internal.configurators.BundleModelClassConfigurator.java
License:Apache License
private void checkForCreateListTypeType(Configuration conf, final Class<?> propertyType) throws NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { if (!listTypeProxyCreatedSet.contains(propertyType)) { ProxyFactory factory = new ProxyFactory(); factory.setSuperclass(ListTypeUserType.class); factory.setFilter(new MethodFilter() { @Override//w w w .j ava 2s . c o m public boolean isHandled(Method method) { return Modifier.isAbstract(method.getModifiers()); } }); MethodHandler handler = new MethodHandler() { @Override public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { if (thisMethod.getName().equals("returnedClass") && args.length == 0) { LOG.debug("Handling method returnedClass() of type ListTypeUserType", thisMethod); return propertyType; } else { throw new UnsupportedOperationException(); } } }; Object type = factory.create(new Class<?>[0], new Object[0], handler); conf.registerTypeOverride((UserType) type, new String[] { propertyType.getSimpleName(), propertyType.getName() }); listTypeProxyCreatedSet.add(propertyType); } }