Exception description
### Error updating database. Cause: : Missing the data source name: 'm0'
### The error may exist in com/zzg/mapper/ (best guess)
### The error may involve -Inline
### The error occurred while setting parameters
### Cause: : no table route info] with root cause
: no table route info
Cause of exception
@RequestMapping(value = "/batchInsert", method = { }) public Object batchInsert() { for (int i = 0; i < 10; i++) { Order order = new Order(); (new BigDecimal(())); (new Random().nextLong()); ("0"); (order); } return "Batch new additions successfully"; }
When adding the Order entity attribute with MyBatis-plus, it is prompted to Missing the data source name: 'm0'
The reason is that the userId attribute value is used to fill the Long value generated by a random function, which causes the sharding-jdbc routing engine to perform analysis and calculate the value of the database rule calculated by itself, resulting in an output of a non-existent data source.
Adjusted insert function code:
@RequestMapping(value = "/batchInsert", method = { }) public Object batchInsert() { for (int i = 0; i < 10; i++) { Order order = new Order(); (new BigDecimal(())); (("" + i)); ("0"); (order); } return "Batch new additions successfully"; }
Summarize
The above is personal experience. I hope you can give you a reference and I hope you can support me more.