Package com.mysema.query.sql

Examples of com.mysema.query.sql.Configuration


    public OracleQueryFactory(Configuration configuration, Provider<Connection> connection) {
        super(configuration, connection);
    }

    public OracleQueryFactory(Provider<Connection> connection) {
        this(new Configuration(new OracleTemplates()), connection);
    }
View Full Code Here


    public OracleQueryFactory(Provider<Connection> connection) {
        this(new Configuration(new OracleTemplates()), connection);
    }

    public OracleQueryFactory(SQLTemplates templates, Provider<Connection> connection) {
        this(new Configuration(templates), connection);
    }
View Full Code Here

    private SetQueryBandClause clause;

    @Before
    public void setUp() {
        conf = new Configuration(SQLTemplates.DEFAULT);
        conf.setUseLiterals(true);
        clause = new SetQueryBandClause(null, conf);
    }
View Full Code Here

*
*/
public class ExtendedSQLQuery extends AbstractSQLQuery<ExtendedSQLQuery> {

    public ExtendedSQLQuery(SQLTemplates templates) {
        super(null, new Configuration(templates), new DefaultQueryMetadata());
    }
View Full Code Here

    public ExtendedSQLQuery(SQLTemplates templates) {
        super(null, new Configuration(templates), new DefaultQueryMetadata());
    }

    public ExtendedSQLQuery(Connection conn, SQLTemplates templates) {
        super(conn, new Configuration(templates), new DefaultQueryMetadata());
    }
View Full Code Here

    @Override
    protected void configure() {
        super.configure();
        bind(NamingStrategy.class, DefaultNamingStrategy.class);
        bind(Configuration.class, new Configuration(SQLTemplates.DEFAULT));
        bind(Serializer.class, MetaDataSerializer.class);
        bind(QueryTypeFactory.class, SQLQueryTypeFactory.class);
        bind(BEAN_SERIALIZER, (Class<?>)null);

        bind(INNER_CLASSES_FOR_KEYS, false);
View Full Code Here

        } else {
            project.addCompileSourceRoot(targetFolder);
        }

        try {
            Configuration configuration = new Configuration(SQLTemplates.DEFAULT);
            NamingStrategy namingStrategy;
            if (namingStrategyClass != null) {
                namingStrategy = (NamingStrategy) Class.forName(namingStrategyClass).newInstance();
            } else {
                namingStrategy = new DefaultNamingStrategy();
            }

            // defaults for Scala
            if (createScalaSources) {
                if (serializerClass == null) {
                    serializerClass = "com.mysema.query.scala.sql.ScalaMetaDataSerializer";
                }
                if (exportBeans && beanSerializerClass == null) {
                    beanSerializerClass = "com.mysema.query.scala.ScalaBeanSerializer";
                }
            }

            MetaDataExporter exporter = new MetaDataExporter();
            if (namePrefix != null) {
                exporter.setNamePrefix(namePrefix);
            }
            if (nameSuffix != null) {
                exporter.setNameSuffix(nameSuffix);
            }
            if (beanPrefix != null) {
                exporter.setBeanPrefix(beanPrefix);
            }
            if (beanSuffix != null) {
                exporter.setBeanSuffix(beanSuffix);
            }
            exporter.setCreateScalaSources(createScalaSources);
            exporter.setPackageName(packageName);
            exporter.setBeanPackageName(beanPackageName);
            exporter.setInnerClassesForKeys(innerClassesForKeys);
            exporter.setTargetFolder(new File(targetFolder));
            exporter.setNamingStrategy(namingStrategy);
            exporter.setSchemaPattern(schemaPattern);
            exporter.setTableNamePattern(tableNamePattern);
            exporter.setColumnAnnotations(columnAnnotations);
            exporter.setValidationAnnotations(validationAnnotations);
            exporter.setSchemaToPackage(schemaToPackage);
            exporter.setLowerCase(lowerCase);
            exporter.setExportTables(exportTables);
            exporter.setExportViews(exportViews);
            exporter.setExportAll(exportAll);
            exporter.setExportPrimaryKeys(exportPrimaryKeys);
            exporter.setExportForeignKeys(exportForeignKeys);
            exporter.setSpatial(spatial);

            if (imports != null && imports.length > 0) {
                exporter.setImports(imports);
            }

            if (serializerClass != null) {
                try {
                    exporter.setSerializerClass((Class)Class.forName(serializerClass));
                } catch (ClassNotFoundException e) {
                    getLog().error(e);
                    throw new MojoExecutionException(e.getMessage(), e);
                }
            }
            if (exportBeans) {
                if (beanSerializerClass != null) {
                    exporter.setBeanSerializerClass((Class)Class.forName(beanSerializerClass));
                } else {
                    BeanSerializer serializer = new BeanSerializer();
                    if (beanInterfaces != null) {
                        for (String iface : beanInterfaces) {
                            int sepIndex = iface.lastIndexOf('.');
                            if (sepIndex < 0) {
                                serializer.addInterface(new SimpleType(iface));
                            } else {
                                String packageName = iface.substring(0, sepIndex);
                                String simpleName = iface.substring(sepIndex + 1);
                                serializer.addInterface(new SimpleType(iface, packageName, simpleName));
                            }
                        }
                    }
                    serializer.setAddFullConstructor(beanAddFullConstructor);
                    serializer.setAddToString(beanAddToString);
                    serializer.setPrintSupertype(beanPrintSupertype);
                    exporter.setBeanSerializer(serializer);
                }

            }
            String sourceEncoding = (String)project.getProperties().get("project.build.sourceEncoding");
            if (sourceEncoding != null) {
                exporter.setSourceEncoding(sourceEncoding);
            }

            if (customTypes != null) {
                for (String cl : customTypes) {
                    configuration.register((Type<?>) Class.forName(cl).newInstance());
                }
            }
            if (typeMappings != null) {
                for (TypeMapping mapping : typeMappings) {
                    Class<?> typeClass = Class.forName(mapping.type);
                    if (Type.class.isAssignableFrom(typeClass)) {
                        configuration.register(mapping.table, mapping.column, (Type<?>)typeClass.newInstance());
                    } else {
                        configuration.register(mapping.table, mapping.column, typeClass);
                    }
                }
            }
            if (numericMappings != null) {
                for (NumericMapping mapping : numericMappings) {
                    int total = Math.max(mapping.size, mapping.total);
                    int decimal = Math.max(mapping.digits, mapping.decimal);
                    configuration.registerNumeric(total, decimal, Class.forName(mapping.javaType));
                }
            }
            if (columnComparatorClass != null) {
                try {
                    exporter.setColumnComparatorClass( (Class) Class.forName(this.columnComparatorClass).asSubclass(Comparator.class));
View Full Code Here

*
*/
public class JPASQLQuery extends AbstractJPASQLQuery<JPASQLQuery> {

    public JPASQLQuery(EntityManager entityManager, SQLTemplates sqlTemplates) {
        super(entityManager, new Configuration(sqlTemplates));
    }
View Full Code Here

    public JPASQLQuery(EntityManager entityManager, Configuration conf, QueryHandler queryHandler) {
        super(entityManager, conf, queryHandler);
    }

    public JPASQLQuery(EntityManager entityManager, SQLTemplates sqlTemplates, QueryMetadata metadata) {
        super(entityManager, new Configuration(sqlTemplates), metadata);
    }
View Full Code Here

        @Override
        public void setUp() throws Exception {
            //NOTE: replacing the templates with a non-quoting one
            previous = configuration;
            configuration = new Configuration(PostGISTemplates.builder().newLineToSingleSpace().build());
            super.setUp();
        }
View Full Code Here

TOP

Related Classes of com.mysema.query.sql.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.