Hello,
Thanks for your enquiry. Batch execution should work just the same as
regular execution. We keep track of all bind variable data types via the
original INSERT statement's columns.
The problem is the fact that unlike JDBC each bind method call binds a full
record, not a specific bind variable. Your original code should read:
public static void transferRecords() {
try (Connection connection = sourceConnectionPool.getConnection();) {
DSLContext create = DSL.using(connection, SQLDialect.MYSQL);
// Create object table entries
BatchBindStep objectBatch =
create.batch(create.insertInto(targetdb.Tables.OBJTABLE,
OBJTABLE.TYPE, OBJTABLE.PARENT).values(null, (ULong)null));
for (sourcedb.tables.records.ObjectRecord record :
sourceDB.fetch(sourcedb.Tables.OBJTABLE,
OBJTABLE.TYPE.equal(ObjectType.account))) {
currentUUID = ULong.valueOf(currentUUID.longValue() + 1);
uuidMap.put(record.getUid().intValue(), currentUUID.intValue());
System.out.println("oldUUID:" + record.getUid() + "
currentUUID: " + currentUUID.longValue());
objectBatch.bind(targetDB.enums.ObjectType.account,
record.getParent());
}
objectBatch.execute();
} catch (SQLException e) {
e.printStackTrace();
}
}
More details about jOOQ's batch feature can be seen here:
http://www.jooq.org/doc/latest/manual/sql-execution/batch-execution/
I guess the manual could be a bit more clear about the 1, 2, 3, 4 being
values for the ID column, not bind value indexes :-)
Hope this helps,
Lukas
2014-11-22 12:46 GMT+01:00 <[email protected]>:
> Attempting to reduce the problem I dropped down to a single database. I've
> tried the enum itself and every permutation of name/literal and ordinal.
>
>
> objectBatch.bind(1, ObjectType.*account*.getLiteral());
>
> objectBatch.bind(1, ObjectType.*account*.getName());
>
> objectBatch.bind(1, ObjectType.*account*.ordinal());
>
>
> All end with the same exception generated not upon the bind on execute. The
> bind method appears to be asking for a generic object. The way I would
> normally do this with MySQL is to bind a string name of the enumeration to
> the statement parm.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.