/** */ public JdbcType getJdbcType() { JdbcType type = new JdbcType(); type.setCacheName("TEST_CACHE"); type.setKeyType(Integer.class); type.setValueType(TestPojo.class); type.setDatabaseSchema("PUBLIC"); type.setDatabaseTable("TEST_CACHE"); type.setKeyFields(new JdbcTypeField(java.sql.Types.INTEGER, "VALUE2", Integer.class, "value2")); type.setValueFields( new JdbcTypeField(java.sql.Types.VARCHAR, "VALUE1", String.class, "value1"), new JdbcTypeField(java.sql.Types.DATE, "VALUE3", java.sql.Date.class, "value3") ); return type; }
storeTypes[0].setKeyFields(new JdbcTypeField(Types.INTEGER, "ID", Integer.class, "id")); storeTypes[0].setKeyFields(new JdbcTypeField(Types.INTEGER, "ID", Integer.class, "id")); new JdbcTypeField(Types.INTEGER, escape ? "ID" : "Id", Integer.class, "id"), new JdbcTypeField(Types.VARCHAR, escape ? "NAME" : "Name", String.class, "name"), new JdbcTypeField(Types.VARCHAR, escape ? "CITY" : "City", String.class, "city")); storeTypes[1].setKeyFields(new JdbcTypeField(Types.INTEGER, "ID", Long.class, "id")); storeTypes[1].setKeyFields(new JdbcTypeField(Types.INTEGER, "ID", Integer.class, "id")); new JdbcTypeField(Types.INTEGER, "ID", Integer.class, "id"), new JdbcTypeField(Types.INTEGER, "ORG_ID", Integer.class, "orgId"), new JdbcTypeField(Types.DATE, "BIRTHDAY", Date.class, "birthday"), new JdbcTypeField(Types.VARCHAR, "NAME", String.class, "name"), new JdbcTypeField(Types.VARCHAR, "GENDER", Gender.class, "gender"));
storeTypes[0].setDatabaseTable("ORGANIZATION"); storeTypes[0].setKeyType("org.apache.ignite.cache.store.jdbc.model.OrganizationKey"); storeTypes[0].setKeyFields(new JdbcTypeField(Types.INTEGER, "ID", Integer.class, "id")); new JdbcTypeField(Types.INTEGER, "ID", Integer.class, "id"), new JdbcTypeField(Types.VARCHAR, "NAME", String.class, "name"), new JdbcTypeField(Types.VARCHAR, "CITY", String.class, "city")); storeTypes[1].setDatabaseTable("PERSON"); storeTypes[1].setKeyType("org.apache.ignite.cache.store.jdbc.model.PersonKey"); storeTypes[1].setKeyFields(new JdbcTypeField(Types.INTEGER, "ID", Integer.class, "id")); new JdbcTypeField(Types.INTEGER, "ID", Integer.class, "id"), new JdbcTypeField(Types.INTEGER, "ORG_ID", Integer.class, "orgId"), new JdbcTypeField(Types.VARCHAR, "NAME", String.class, "name")); storeTypes[2].setKeyType("org.apache.ignite.cache.store.jdbc.model.PersonComplexKey"); storeTypes[2].setKeyFields( new JdbcTypeField(Types.INTEGER, "ID", int.class, "id"), new JdbcTypeField(Types.INTEGER, "ORG_ID", int.class, "orgId"), new JdbcTypeField(Types.INTEGER, "CITY_ID", int.class, "cityId")); new JdbcTypeField(Types.INTEGER, "ID", Integer.class, "id"), new JdbcTypeField(Types.INTEGER, "ORG_ID", Integer.class, "orgId"), new JdbcTypeField(Types.VARCHAR, "NAME", String.class, "name"), new JdbcTypeField(Types.INTEGER, "SALARY", Integer.class, "salary")); storeTypes[3].setDatabaseTable("TIMESTAMP_ENTRIES"); storeTypes[3].setKeyType("java.sql.Timestamp");
/** * Create JDBC type for Person. * * @param cacheName Cache name. * @return Configured JDBC type. */ private static JdbcType jdbcTypePerson(String cacheName) { JdbcType jdbcType = new JdbcType(); jdbcType.setCacheName(cacheName); jdbcType.setDatabaseSchema("PUBLIC"); jdbcType.setDatabaseTable("PERSON"); jdbcType.setKeyType("org.apache.ignite.PersonKey"); jdbcType.setValueType("org.apache.ignite.Person"); jdbcType.setKeyFields( new JdbcTypeField(Types.NUMERIC, "ID", long.class, "id") ); jdbcType.setValueFields( new JdbcTypeField(Types.VARCHAR, "FIRST_NAME", String.class, "firstName"), new JdbcTypeField(Types.VARCHAR, "LAST_NAME", String.class, "lastName"), new JdbcTypeField(Types.DOUBLE, "SALARY", Double.class, "salary") ); return jdbcType; }