v6.0.4 (2025-05-29)
<dependency>
<groupId>net.hasor</groupId>
<artifactId>dbvisitor</artifactId>
<version>6.0.4</version>
</dependency>
Impact
- Queries built with the condition builder
Changes
- [Fixed] When
selectTemplateis configured and the condition builder generates a query without an explicit select list, the SQL now correctly includes theselectTemplate. - [Fixed] OracleDialect now supports
DuplicateKeyStrategy.Update(thanks to ooknight). - [Improved] When the condition builder uses
group bywithout specifying select columns, the builder no longer auto-adds the group by list; it uses*instead. The resulting SQL may not run, but surfaces the issue during development and avoids per-call checks for better performance.
Example:
@Data
@Table("t_sample")
public class Sample {
@Column(name = "id", primary = true)
private Long id;
@Column(selectTemplate = "AsText(point)", // Generates select AsText(point) as point
insertTemplate = "GeomFromText(?)", // Generates insert ... values (GeomFromText(?))
setValueTemplate = "GeomFromText(?)",// Generates update ... set point = GeomFromText(?)
whereColTemplate = "AsText(point)" // Generates ... where AsText(point) = ?
)
private String point;
}
lambdaQuery.and(qb -> qb.eq(Sample::getPoint, "POINT (11 11)"))
.queryForList();
-- Generated query:
SELECT id , AsText(point) point FROM t_sample WHERE ( AsText(point) = ? )
More
selectTemplate is a dbVisitor feature for generating SQL during object mapping. For example, when reading/writing MySQL point columns, the template can inject PointFromText/AsText functions into generated SQL. See SQL templates for details.