jack_zhang
jack_zhang
1.无论是org.springframework.beans或者org.apache.commons.beanutils,与get/set方式相比,都存在性能问题。 2.效率由高到底:get/set 》PropertyUtils 》BeanUtils。
```properties spring.jpa.properties.hibernate.jdbc.batch_size=100 spring.jpa.properties.hibernate.order_inserts=true ``` The first property tells Hibernate to collect inserts in batches of four. The order_inserts property tells Hibernate to take the time to group inserts by entity,...
同时需要注意控制好事务大小
开启监控 `spring.jpa.properties.hibernate.generate_statistics=true` ```` 16577314 nanoseconds spent preparing 100 JDBC statements; 2207548 nanoseconds spent executing 100 JDBC statements; 2003005 nanoseconds spent executing 1 JDBC batches; ````
参考:https://github.com/zhangzhenhuajack/spring-data-jpa-guide/tree/master/2.3/jpa_id_generator_batch_insert

一般建议通过如下方式解决: ```` @Entity public class Product { @Column private String colorValue; @Transient public Color getColor() { return Color.fromValue(colorValue); } public void setColor(Color color) { this.colorValue = color.toValue(); } } ````...
需要搞清楚:数据源,连接,事务的关系。
### 循环引用问题:@JsonManagedReference and @JsonBackReference ```` public class User { public int id; public String name; @JsonManagedReference public List userItems; } public class Item { public int id; public String itemName;...