XML / HQL Dynamic SQL Preview
Complete preview of dynamic SQL in mapper XML — rendered per MyBatis semantics with OGNL expression toggles. Hibernate HQL and JPA JPQL previews are supported as well (see below).
Trigger Method
Gutter icon at <select> / <update> / <delete> / <insert> lines in mapper XML. Click to preview.
Supported Dynamic Tags
| Tag | Description |
|---|---|
<if> | Conditional rendering, test expressions toggleable in panel |
<choose> / <when> / <otherwise> | Branch selection |
<where> | Smart WHERE concatenation (strips AND/OR) |
<set> | Smart SET concatenation (strips commas) |
<foreach> | Collection iteration, values editable in panel |
<bind> | Variable binding |
<sql> + <include> | SQL fragment reuse |
<trim> | Custom trimming |
OGNL Expression Panel
OGNL expressions in dynamic conditions (e.g. name != null and name != '') can be toggled in the left panel, with SQL updating in real time.
Example
<select id="selectActive" resultType="User">
SELECT * FROM user
<where>
<if test="name != null and name != ''">
AND name LIKE #{name}
</if>
<if test="status != null">
AND status = #{status}
</if>
</where>
ORDER BY create_time DESC
</select>Rendered result (name toggled on, status off):
SELECT * FROM user
WHERE name LIKE ?
ORDER BY create_time DESCHQL / JPQL Preview
Beyond mapper XML, the plugin also previews Hibernate HQL and JPA JPQL statically. All entry points appear as gutter icons in Java source lines:
| Entry | Location |
|---|---|
Hibernate HQL calls (session.createQuery(hql)) | The HQL string line |
@Query("...") annotations (JPQL) | The annotation line |
JPA Repository derived methods (findByXxx...) | The method declaration line |
JPA CriteriaQuery chains (cq.from / cb.equal etc.) | The call chain line |
Custom DAO HQL query methods (e.g. commonDao.findByQuery) | The call line |
HQL strings split across multiple lines with +, or concatenated via chained assignments, are recognized as well — the gutter icon still appears.
SELECT Entity Alias Expansion
In HQL semantics, SELECT u means "fetch the whole entity u", but emitting it verbatim makes MySQL fail with [1054] Unknown column 'u' in 'field list'. The plugin expands bare entity aliases into the entity's column list automatically:
-- HQL: SELECT u FROM User u WHERE u.status = 1
-- After expansion:
SELECT u.id, u.name, u.status, ... FROM user u WHERE u.status = 1Expansion rules:
- Only bare aliases registered in FROM / JOIN are expanded; DELETE / DISTINCT / subqueries / aggregates / explicit column lists are untouched
- When the query has no SELECT clause, the column list is added automatically
- Falls back to
alias.*when a JOIN side table or entity metadata is missing