@Test(expected = SQLException.class) public void testUpdateIdNoId() throws Exception { MappedUpdateId.build(databaseType, new TableInfo<NoId, Void>(connectionSource, null, NoId.class)); }
public static <T, ID> MappedUpdateId<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo) throws SQLException { FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException("Cannot update-id in " + tableInfo.getDataClass() + " because it doesn't have an id field"); } StringBuilder sb = new StringBuilder(64); appendTableName(databaseType, sb, "UPDATE ", tableInfo.getTableName()); sb.append("SET "); appendFieldColumnName(databaseType, sb, idField, null); sb.append("= ? "); appendWhereFieldEq(databaseType, idField, sb, null); return new MappedUpdateId<T, ID>(tableInfo, sb.toString(), new FieldType[] { idField, idField }); }
MappedUpdateId extends BaseMappedStatement<T, ID> { public static <T, ID> MappedUpdateId<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo) throws SQLException { FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException("Cannot update-id in " + tableInfo.getDataClass() + " because it doesn't have an id field"); } StringBuilder sb = new StringBuilder(64); appendTableName(databaseType, sb, "UPDATE ", tableInfo.getTableName()); sb.append("SET "); appendFieldColumnName(databaseType, sb, idField, null); sb.append("= ? "); appendWhereFieldEq(databaseType, idField, sb, null); return new MappedUpdateId<T, ID>(tableInfo, sb.toString(), new FieldType[] { idField, idField }); } }
MappedUpdateId extends BaseMappedStatement<T, ID> { public static <T, ID> MappedUpdateId<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo) throws SQLException { FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException("Cannot update-id in " + tableInfo.getDataClass() + " because it doesn't have an id field"); } StringBuilder sb = new StringBuilder(64); appendTableName(databaseType, sb, "UPDATE ", tableInfo.getTableName()); sb.append("SET "); appendFieldColumnName(databaseType, sb, idField, null); sb.append("= ? "); appendWhereFieldEq(databaseType, idField, sb, null); return new MappedUpdateId<T, ID>(tableInfo, sb.toString(), new FieldType[] { idField, idField }); } private  MappedUpdateId(TableInfo<T, ID> tableInfo, String statement, FieldType[] argFieldTypes); }
MappedUpdateId extends BaseMappedStatement<T, ID> { public static <T, ID> MappedUpdateId<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo) throws SQLException { FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException("Cannot update-id in " + tableInfo.getDataClass() + " because it doesn't have an id field"); } StringBuilder sb = new StringBuilder(64); appendTableName(databaseType, sb, "UPDATE ", tableInfo.getTableName()); sb.append("SET "); appendFieldColumnName(databaseType, sb, idField, null); sb.append("= ? "); appendWhereFieldEq(databaseType, idField, sb, null); return new MappedUpdateId<T, ID>(tableInfo, sb.toString(), new FieldType[] { idField, idField }); } private  MappedUpdateId(TableInfo<T, ID> tableInfo, String statement, FieldType[] argFieldTypes); int execute(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache); static MappedUpdateId<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo); }
MappedUpdateId extends BaseMappedStatement<T, ID> { public static <T, ID> MappedUpdateId<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo) throws SQLException { FieldType idField = tableInfo.getIdField(); if (idField == null) { throw new SQLException("Cannot update-id in " + tableInfo.getDataClass() + " because it doesn't have an id field"); } StringBuilder sb = new StringBuilder(64); appendTableName(databaseType, sb, "UPDATE ", tableInfo.getTableName()); sb.append("SET "); appendFieldColumnName(databaseType, sb, idField, null); sb.append("= ? "); appendWhereFieldEq(databaseType, idField, sb, null); return new MappedUpdateId<T, ID>(tableInfo, sb.toString(), new FieldType[] { idField, idField }); } private  MappedUpdateId(TableInfo<T, ID> tableInfo, String statement, FieldType[] argFieldTypes); int execute(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache); static MappedUpdateId<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo);  }