Package org.openengsb.core.edbi.jdbc.sql

Examples of org.openengsb.core.edbi.jdbc.sql.DataType


        index.accept(new IndexFieldVisitor() {
            @Override
            public void visit(IndexField<?> field) {
                onBeforeFieldVisit(table, field);

                DataType type = getTypeMap().getType(field.getType());
                if (type == null) {
                    onMissingTypeVisit(table, field);
                    return;
                }
                ((JdbcIndexField) field).setMappedType(type);
View Full Code Here


        if (idField == null) {
            LOG.warn("@Model class {} does not have an @OpenEngSBModelId", field.getType());
            return;
        }

        DataType type = getTypeMap().getType(idField.getType());

        if (type == null) {
            LOG.warn("@OpenEngSBModelId field {} has an unmapped type {}", field.getName(), field.getType());
            return;
        }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        // Type Map
        TypeMap typeMap = mock(TypeMap.class);
        when(typeMap.getType(String.class)).thenReturn(new DataType(Types.LONGVARCHAR, "LONGVARCHAR"));
        when(typeMap.getType(Integer.class)).thenReturn(new DataType(Types.INTEGER, "INTEGER"));
        when(typeMap.getType(Long.class)).thenReturn(new DataType(Types.BIGINT, "LONG"));
        when(typeMap.getType(Date.class)).thenReturn(new DataType(Types.TIMESTAMP, "TIMESTAMP"));
        when(typeMap.getType(UUID.class)).thenReturn(new DataType(Types.VARCHAR, "VARCHAR"));

        // Translators
        IndexNameTranslator headIndexNameTranslator = new IndexNameTranslator() {
            @Override
            public String translate(Index<?> index) {
View Full Code Here

        testIndex.setFields(Arrays.asList(testId, testInteger, subModel));

        // Type Map
        TypeMap typeMap = mock(TypeMap.class);
        when(typeMap.getType(String.class)).thenReturn(new DataType(Types.LONGNVARCHAR, "LONGVARCHAR"));
        when(typeMap.getType(UUID.class)).thenReturn(new DataType(Types.VARCHAR, "VARCHAR"));
        when(typeMap.getType(Integer.class)).thenReturn(new DataType(Types.INTEGER, "INTEGER"));
        when(typeMap.getType(Long.class)).thenReturn(new DataType(Types.BIGINT, "LONG"));
        when(typeMap.getType(Date.class)).thenReturn(new DataType(Types.TIMESTAMP, "TIMESTAMP"));

        engine = createEngine(getDataSource(), typeMap);
    }
View Full Code Here

        jdbc = new JdbcTemplate(getDataSource());
        jdbcn = new NamedParameterJdbcTemplate(getDataSource());

        table = new Table("TEST",
            new Column("ID", new DataType("IDENTITY")),
            new Column("NAME", new DataType("VARCHAR")),
            new Column("AGE", new DataType("INT")));

        table.addElement(new PrimaryKeyConstraint("ID"));

        jdbc.execute("CREATE TABLE `TEST` (ID IDENTITY PRIMARY KEY, NAME VARCHAR, AGE INT)");
    }
View Full Code Here

                ps.setObject(1, index.getName());
                ps.setObject(2, field.getName());
                ps.setObject(3, field.getType().getCanonicalName());
                ps.setObject(4, field.getMappedName());

                DataType type = (DataType) field.getMappedType();
                ps.setObject(5, type.getType());
                ps.setObject(6, type.getName());
                ps.setObject(7, type.getScale());
            }
        });
    }
View Full Code Here

                private DataType mapDataType(ResultSet rs) throws SQLException {
                    int type = rs.getInt("MAPPED_TYPE");
                    String name = rs.getString("MAPPED_TYPE_NAME");
                    int scale = rs.getInt("MAPPED_TYPE_SCALE");

                    return new DataType(type, name, scale);
                }

            }, index.getName());
        } catch (EmptyResultDataAccessException e) {
            LOG.warn("Could not find any fields for index {}", index.getName());
View Full Code Here

     * @param type the type of {@code java.sql.Types}
     * @param name the name of the type corresponding to the used dbms
     * @return the DataType created
     */
    protected DataType put(Class<?> clazz, int type, String name) {
        DataType dataType = new DataType(type, name);
        map.put(clazz, dataType);
        return dataType;
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.edbi.jdbc.sql.DataType

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.