public Table addDenormalizedTable( String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable) throws MappingException { String key = subselect==null ? Table.qualify(catalog, schema, name, '.') : subselect; if ( tables.containsKey(key) ) { throw new MappingException("duplicate table: " + name); } Table table = new DenormalizedTable(includedTable); table.setAbstract(isAbstract); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); table.setSubselect(subselect); tables.put(key, table); return table; }
public Table addDenormalizedTable( String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable) throws MappingException { String key = subselect==null ? Table.qualify(catalog, schema, name) : subselect; if ( tables.containsKey(key) ) { throw new DuplicateMappingException("table", name); } Table table = new DenormalizedTable(includedTable); table.setAbstract(isAbstract); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); table.setSubselect(subselect); tables.put(key, table); return table; }
public Table addTable(String schema, String catalog, String name, String subselect, boolean isAbstract ) { String key = subselect==null ? Table.qualify(catalog, schema, name, '.') : subselect; Table table = (Table) tables.get(key); if (table == null) { table = new Table(); table.setAbstract(isAbstract); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); table.setSubselect(subselect); tables.put(key, table); } else { if (!isAbstract) table.setAbstract(false); } return table; }
public Table addTable(String schema, String catalog, String name, String subselect, boolean isAbstract ) { String key = subselect==null ? Table.qualify(catalog, schema, name) : subselect; Table table = (Table) tables.get(key); if (table == null) { table = new Table(); table.setAbstract(isAbstract); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); table.setSubselect(subselect); tables.put(key, table); } else { if (!isAbstract) table.setAbstract(false); } return table; }
@Override public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { Class<?> valuesEntity; boolean registerValuesEntity = true; try { valuesEntity = Class.forName("com.blazebit.persistence.impl.function.entity.ValuesEntity"); } catch (ClassNotFoundException e) { throw new RuntimeException("Are you missing blaze-persistence-core-impl on the classpath?", e); } Iterator<PersistentClass> iter = configuration.getClassMappings(); while (iter.hasNext()) { PersistentClass clazz = iter.next(); Class<?> entityClass = clazz.getMappedClass(); if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) { clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } } if (registerValuesEntity) { // Register values entity if wasn't found configuration.addAnnotatedClass(valuesEntity); configuration.buildMappings(); PersistentClass clazz = configuration.getClassMapping(valuesEntity.getName()); clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver()); serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(configuration.getTableMappings(), sessionFactory.getDialect(), new SimpleTableNameFormatter(), configuration.buildMapping())); }
@Override public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { Class<?> valuesEntity; boolean registerValuesEntity = true; try { valuesEntity = Class.forName("com.blazebit.persistence.impl.function.entity.ValuesEntity"); } catch (ClassNotFoundException e) { throw new RuntimeException("Are you missing blaze-persistence-core-impl on the classpath?", e); } Iterator<PersistentClass> iter = configuration.getClassMappings(); while (iter.hasNext()) { PersistentClass clazz = iter.next(); Class<?> entityClass = clazz.getMappedClass(); if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) { clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } } if (registerValuesEntity) { // Register values entity if wasn't found configuration.addAnnotatedClass(valuesEntity); configuration.buildMappings(); PersistentClass clazz = configuration.getClassMapping(valuesEntity.getName()); clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver()); serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(configuration.getTableMappings(), sessionFactory.getDialect(), new SimpleTableNameFormatter(), configuration.buildMapping())); }
clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); configuration.buildMappings(); PersistentClass clazz = configuration.getClassMapping(valuesEntity.getName()); clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName());
public Table addDenormalizedTable( String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable) throws DuplicateMappingException { name = getObjectNameNormalizer().normalizeIdentifierQuoting( name ); schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema ); catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog ); String key = subselect == null ? Table.qualify(catalog, schema, name) : subselect; if ( tables.containsKey( key ) ) { throw new DuplicateMappingException( "table", name ); } Table table = new DenormalizedTable( includedTable ); table.setAbstract( isAbstract ); table.setName( name ); table.setSchema( schema ); table.setCatalog( catalog ); table.setSubselect( subselect ); tables.put( key, table ); return table; }
public Table addDenormalizedTable( String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable) throws DuplicateMappingException { name = getObjectNameNormalizer().normalizeIdentifierQuoting( name ); schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema ); catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog ); String key = subselect == null ? Table.qualify(catalog, schema, name) : subselect; if ( tables.containsKey( key ) ) { throw new DuplicateMappingException( "table", name ); } Table table = new DenormalizedTable( includedTable ); table.setAbstract( isAbstract ); table.setName( name ); table.setSchema( schema ); table.setCatalog( catalog ); table.setSubselect( subselect ); tables.put( key, table ); return table; }
public Table addTable( String schema, String catalog, String name, String subselect, boolean isAbstract) { name = getObjectNameNormalizer().normalizeIdentifierQuoting( name ); schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema ); catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog ); String key = subselect == null ? Table.qualify( catalog, schema, name ) : subselect; Table table = tables.get( key ); if ( table == null ) { table = new Table(); table.setAbstract( isAbstract ); table.setName( name ); table.setSchema( schema ); table.setCatalog( catalog ); table.setSubselect( subselect ); tables.put( key, table ); } else { if ( !isAbstract ) { table.setAbstract( false ); } } return table; }
public Table addTable( String schema, String catalog, String name, String subselect, boolean isAbstract) { name = getObjectNameNormalizer().normalizeIdentifierQuoting( name ); schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema ); catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog ); String key = subselect == null ? Table.qualify( catalog, schema, name ) : subselect; Table table = tables.get( key ); if ( table == null ) { table = new Table(); table.setAbstract( isAbstract ); table.setName( name ); table.setSchema( schema ); table.setCatalog( catalog ); table.setSubselect( subselect ); tables.put( key, table ); } else { if ( !isAbstract ) { table.setAbstract( false ); } } return table; }
@Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { // TODO: remember metadata for exact column types for (PersistentClass clazz : metadata.getEntityBindings()) { Class<?> entityClass = clazz.getMappedClass(); if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) { clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } } serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver()); TableNameFormatter formatter = new NativeTableNameFormatter(sessionFactory.getJdbcServices().getJdbcEnvironment().getQualifiedObjectNameFormatter()); serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(getTableIterator(metadata.getDatabase().getNamespaces()), sessionFactory.getDialect(), formatter, metadata)); }
@Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { for (PersistentClass clazz : metadata.getEntityBindings()) { Class<?> entityClass = clazz.getMappedClass(); if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) { clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } } serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver()); TableNameFormatter formatter = new NativeTableNameFormatter(sessionFactory.getJdbcServices().getJdbcEnvironment().getQualifiedObjectNameFormatter()); serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(getTableIterator(metadata.getDatabase().getNamespaces()), sessionFactory.getDialect(), formatter, metadata)); }
@Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { for (PersistentClass clazz : metadata.getEntityBindings()) { Class<?> entityClass = clazz.getMappedClass(); if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) { clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } } serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver()); TableNameFormatter formatter = new NativeTableNameFormatter(sessionFactory.getJdbcServices().getJdbcEnvironment().getQualifiedObjectNameFormatter()); serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(getTableIterator(metadata.getDatabase().getNamespaces()), sessionFactory.getDialect(), formatter, metadata)); }
@Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { // TODO: remember metadata for exact column types for (PersistentClass clazz : metadata.getEntityBindings()) { Class<?> entityClass = clazz.getMappedClass(); if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) { clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } } serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver()); TableNameFormatter formatter = new NativeTableNameFormatter(sessionFactory.getJdbcServices().getJdbcEnvironment().getQualifiedObjectNameFormatter()); serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(getTableIterator(metadata.getDatabase().getNamespaces()), sessionFactory.getDialect(), formatter, metadata)); }
@Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { for (PersistentClass clazz : metadata.getEntityBindings()) { Class<?> entityClass = clazz.getMappedClass(); if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) { clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } } serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver()); TableNameFormatter formatter = new NativeTableNameFormatter(sessionFactory.getJdbcServices().getJdbcEnvironment().getQualifiedObjectNameFormatter()); serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(getTableIterator(metadata.getDatabase().getNamespaces()), sessionFactory.getJdbcServices().getDialect(), formatter, metadata)); }
@Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { for (PersistentClass clazz : metadata.getEntityBindings()) { Class<?> entityClass = clazz.getMappedClass(); if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) { clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } } serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver()); TableNameFormatter formatter = new NativeTableNameFormatter(sessionFactory.getJdbcServices().getJdbcEnvironment().getQualifiedObjectNameFormatter()); serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(getTableIterator(metadata.getDatabase().getNamespaces()), sessionFactory.getJdbcServices().getDialect(), formatter, metadata)); }
@Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { // TODO: remember metadata for exact column types for (PersistentClass clazz : metadata.getEntityBindings()) { Class<?> entityClass = clazz.getMappedClass(); if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) { clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } } serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver()); TableNameFormatter formatter = new NativeTableNameFormatter(sessionFactory.getJdbcServices().getJdbcEnvironment().getQualifiedObjectNameFormatter()); serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(getTableIterator(metadata.getDatabase().getNamespaces()), sessionFactory.getDialect(), formatter, metadata)); }
@Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { // TODO: remember metadata for exact column types for (PersistentClass clazz : metadata.getEntityBindings()) { Class<?> entityClass = clazz.getMappedClass(); if (entityClass != null && entityClass.isAnnotationPresent(CTE.class)) { clazz.getTable().setSubselect("select * from " + clazz.getJpaEntityName()); } } serviceRegistry.locateServiceBinding(PersisterClassResolver.class).setService(new CustomPersisterClassResolver()); TableNameFormatter formatter = new NativeTableNameFormatter(sessionFactory.getJdbcServices().getJdbcEnvironment().getQualifiedObjectNameFormatter()); serviceRegistry.locateServiceBinding(Database.class).setService(new SimpleDatabase(getTableIterator(metadata.getDatabase().getNamespaces()), sessionFactory.getDialect(), formatter, metadata)); }