You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have 2 tables: Table A, Table B.
A has one-to-many on B relationship via FK;
Batch b=c.createBatch(); //<--Creating batch
b.add("insert into A(f1,f2) values('F1','F2')");
b.add("insert into B(f3,key_to_A) values('custom data1',IDENT_CURRENT('A'))");
b.add("insert into B(f3,key_to_A) values('custom data2',IDENT_CURRENT('A'))");
b.add("insert into B(f3,key_to_A) values('custom data3',IDENT_CURRENT('A'))");
b.execute();
After that, data in table A inserted, but no data in table B and no error or warning generated.
I did try to create ALIAS for IDENT_CURRENT, but it didn't work to me as well.
no data
// your stack trace here
Table schema
create table if not exists A (
Id bigint auto_increment primary key,
f1 nvarchar(100),
f2 nvarchar(100)
);
create table if not exists b(
id bigint auto_increment,
key_to_A bigint constraint A_FK references A,
f3 nvarchar(100)
);
Input Code
-- your SQL here;
Steps to reproduce
Java 8.
Create a simple project, set create SQL Server mode.
create a batch with transaction.
add statements to batch
execute, commit, observe no data in table B.
Input Code
// your code here;
Expected behavior/code
Inserted 3 rows into table B
Possible Solution
use a different way to obtain freshly created A.id value to insert into table b? Not sure how to do that.
Additional context
The text was updated successfully, but these errors were encountered:
Bug Report
This issue not reported yet
Versions
Current Behavior
I have 2 tables: Table A, Table B.
A has one-to-many on B relationship via FK;
Batch b=c.createBatch(); //<--Creating batch
b.add("insert into A(f1,f2) values('F1','F2')");
b.add("insert into B(f3,key_to_A) values('custom data1',IDENT_CURRENT('A'))");
b.add("insert into B(f3,key_to_A) values('custom data2',IDENT_CURRENT('A'))");
b.add("insert into B(f3,key_to_A) values('custom data3',IDENT_CURRENT('A'))");
b.execute();
After that, data in table A inserted, but no data in table B and no error or warning generated.
I did try to create ALIAS for IDENT_CURRENT, but it didn't work to me as well.
no data
Table schema
create table if not exists A (
Id bigint auto_increment primary key,
f1 nvarchar(100),
f2 nvarchar(100)
);
create table if not exists b(
id bigint auto_increment,
key_to_A bigint constraint A_FK references A,
f3 nvarchar(100)
);
Input Code
-- your SQL here;
Steps to reproduce
Java 8.
Create a simple project, set create SQL Server mode.
create a batch with transaction.
add statements to batch
execute, commit, observe no data in table B.
Input Code
// your code here;
Expected behavior/code
Inserted 3 rows into table B
Possible Solution
use a different way to obtain freshly created A.id value to insert into table b? Not sure how to do that.
Additional context
The text was updated successfully, but these errors were encountered: