Comments (7)
from shardingsphere.
where should i start from?
from shardingsphere.
Hi, could you please provide your insert sql?
from shardingsphere.
Hi, could you please provide your insert sql?
thanks for replying。
i have been using saveBatch ofmybatis plus to insert data,such as 【clockRecordService.saveBatch(records)】。printed sql is following:
Logic SQL : INSERT INTO kq_employee_clock_record (
id,
employee_id,
clock_time,
clock_day,
clock_day_time,
longitude,
latitude,
address,
source,
os,
browser,
create_dt,
create_user,
update_dt,
update_user
)
VALUES
( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
2024-03-08 13 : 23 : 28 [ INFO ] [ XNIO - 1 task - 1 ] ShardingSphere - SQL : < 0.1 >< ziti918130105703170048 > Actual SQL : datasource ::: INSERT INTO kq_employee_clock_record_202402 (
id,
employee_id,
clock_time,
clock_day,
clock_day_time,
longitude,
latitude,
address,
source,
os,
browser,
create_dt,
create_user,
update_dt,
update_user
)
VALUES
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ::: [ NULL,
65256,
2024-02-01 00 : 00 : 00.0,
2024-02-01,
00 : 00 : 00,
118.787651,
32.035561,
**建设银行江苏省分行秦淮洪武路 188号,
2,
win11,
Chrome Mobile,
2024-03-08 13 : 22 : 46.416,
NULL,
NULL,
NULL ]
testting sample is following
` public void testGenerator() throws Exception {
List records = new ArrayList<>(3);
EmployeeClockRecord clockRecord1 = new EmployeeClockRecord();
clockRecord1.setEmployeeId(65256L);
clockRecord1.setLongitude(new Double("118.787651"));
clockRecord1.setLatitude(new Double("32.035561"));
Date date = DateUtils.formatStringByStyleToDate("2024-01-31 15:08:40", "yyyy-MM-dd");
clockRecord1.setClockTime(date);
clockRecord1.setClockDay(DateUtils.formatDateByStyle(clockRecord1.getClockTime(), YYYY_MM_DD));
clockRecord1.setClockDayTime(DateUtils.formatDateByStyle(clockRecord1.getClockTime(), HH_MM_SS));
clockRecord1.setSource(2);
clockRecord1.setOs("win11");
clockRecord1.setBrowser("Chrome Mobile");
clockRecord1.setAddress("**建设银行江苏省分行秦淮洪武路188号");
EmployeeClockRecord clockRecord2 = new EmployeeClockRecord();
clockRecord2.setEmployeeId(65256L);
clockRecord2.setLongitude(new Double("118.787651"));
clockRecord2.setLatitude(new Double("32.035561"));
Date date2 = DateUtils.formatStringByStyleToDate("2024-02-01 15:08:40", "yyyy-MM-dd");
// Date date2 = Date.from(localDate2.atStartOfDay(ZoneOffset.ofHours(8)).toInstant());
clockRecord2.setClockTime(date2);
clockRecord2.setClockDay(DateUtils.formatDateByStyle(clockRecord2.getClockTime(), YYYY_MM_DD));
clockRecord2.setClockDayTime(DateUtils.formatDateByStyle(clockRecord1.getClockTime(), HH_MM_SS));
clockRecord2.setSource(2);
clockRecord2.setOs("win11");
clockRecord2.setBrowser("Chrome Mobile");
clockRecord2.setAddress("**建设银行江苏省分行秦淮洪武路188号");
records.add(clockRecord1);
records.add(clockRecord2);
String shardingDataSource ="shardingDataSource";
DynamicDataSourceContextHolder.setDataSourceType(shardingDataSource);
clockRecordService.saveBatch(records);
}
`
from shardingsphere.
OK, I noticed that your insert SQL already contains the id column, so it will not be automatically generated and rewritten.
You can try not to include the id column in the insert statement, then ShardingSphere will generate the value for you and rewrite the insert SQL.
from shardingsphere.
thanks,According to explanation,sovled the problem
from shardingsphere.
Great, happy for you!
from shardingsphere.
Related Issues (20)
- org.yaml.snakeyaml.representer.Representer: method 'void <init>()' not found HOT 16
- spring-boot-starter-parent 3.2.4 use shardingsphere-jdbc-core 5.4.1 throw NoSuchMethodError HOT 1
- database-strategy:none not working HOT 6
- NPE when convert yaml configuration with empty data sources or empty rules
- Load single table should check storage units are not empty
- E2E test,build docker image permission denied. HOT 1
- How to start Native test for jdbc-encrypt HOT 1
- Under one mysql instance, two database schemas, how to join tables cross schemas HOT 2
- Add dependency-check-maven to shardingsphere HOT 2
- how to onlu sharding database? HOT 1
- Version 5.4.1 of ShardingSphere references SnakeYAML version 1.33, which has a security vulnerability. How to upgrade it? HOT 3
- TableNotExistsException: Table or view *** does not exist HOT 1
- some question about Readwrite-splitting HOT 1
- null point error when the table name is unstandardized HOT 1
- 5.4.1 CHAR_DIGEST_LIKE error HOT 8
- Image not loading HOT 1
- gbase 8s Compatibility issues HOT 2
- Database password parsed failed HOT 6
- Use test container instead of docker compose in Agent e2e test
- Native test only support H2?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shardingsphere.