Created
June 28, 2012 14:57
-
-
Save dileeph/3011824 to your computer and use it in GitHub Desktop.
JOOQ - Batch inserting a list of records (not shown in JOOQ tutorial)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testBatch(){ | |
/*Preparing sample data. */ | |
MzRolesRecord admin = new MzRolesRecord(); | |
admin.setCreatedDate(new Timestamp(System.currentTimeMillis())); | |
admin.setRoleDesc("Admin"); | |
MzRolesRecord user = new MzRolesRecord(); | |
user.setCreatedDate(new Timestamp(System.currentTimeMillis())); | |
user.setRoleDesc("User"); | |
List<MzRolesRecord> roles = Lists.newArrayList(admin,user); | |
/*Now to actual batch insert.*/ | |
int[] updates = mzFactory.batchStore(roles).execute(); | |
Assert.assertEquals(2, updates.length); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment