jack_zhang

Results 70 comments of 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

![image](https://user-images.githubusercontent.com/11462004/197322829-ae615823-918b-41f9-9c3f-4dc64973a0fc.png)

一般建议通过如下方式解决: ```` @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;...