The GIS Guy
  • Home
  • iOS
  • Web
  • GIS

Spring

A collection of 2 posts

Java

使用 EntityManager 取消 JPA 一级缓存

JPA 默认开启一级缓存(底层实现是在 EntityManager 层)。 当不同的查询结果映射到同样的 entity 时,一级缓存可能会导致返回数据不符合预期(只查询了一次,后续查询直接返回第一次查询的结果)。 一个例子 一个展示系统的后台,需要分别查询不同指标的月度趋势,查询结果复用同一个 Entity。 @Entity public class MonthlyTrendEntity implements Serializable { private long id; // @Id private Integer year; private Integer month; private

Jon Jon
jsp

Spring MVC jsp 嵌入子页面的两种方式

使用 jsp 渲染页面时,可以在页面中嵌入(include)其他 jsp 页面。嵌入子页面有两种方式: 静态嵌入:<% @include file="include.jsp" %> 动态嵌入:<jsp:include page="include.jsp" /> 静态嵌入 <% @include file="

Jon Jon
The GIS Guy © 2025
Latest Posts Ghost