mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2265 - ArrayIndexOutOfBoundsException: Index -1 out of bounds with @IdClass and batch insert accessing id property
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package org.tests.model.bridge;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Transaction;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -39,6 +41,28 @@ public class TestIdClassScalar extends BaseTestCase {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void insertBatch() {
|
||||
UUID siteId = UUID.randomUUID();
|
||||
UUID userId = UUID.randomUUID();
|
||||
|
||||
try (final Transaction transaction = DB.beginTransaction()) {
|
||||
transaction.setBatchMode(true);
|
||||
|
||||
|
||||
BSiteUserD access = new BSiteUserD(BAccessLevel.ONE, siteId, userId);
|
||||
DB.save(access);
|
||||
|
||||
final UUID siteId1 = access.getSiteId(); // ArrayIndexOutOfBoundsException here
|
||||
assertThat(siteId1).isNotNull();
|
||||
assertThat(access.getUserId()).isEqualTo(userId);
|
||||
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
DB.delete(BSiteUserD.class, new BEmbId(siteId, userId));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user