Environment
Jmix version: 3.0
Bug Description
The domain-model discovery tools of the AI Tools add-on expose every attribute of an entity, including non-persistent ones declared with @JmixProperty on a @Transient field or on a getter (for example, a computed full name or a calculated flag). Such attributes are listed among the regular properties in the entity summary. In the detailed domain model they carry persistent: false, but nothing explains to the model what the flag means, and JPQL validation does not check it.
As a result, the model treats the attribute as a regular column, puts it into the query, the query passes validation and is executed, and the execution fails because the attribute does not exist in the database.
Attributes with @InstanceName on a getter without @JmixProperty are not affected: they are not part of the metamodel and are not exposed at all.
Steps To Reproduce
- In an application with the AI Tools add-on, add a non-persistent attribute to an entity, for example to
User:
@JmixProperty
@Transient
private Boolean vip;
- In the AI chat, ask: "Show me one user with the vip field".
Current Behavior
aitls_getAvailableEntities lists vip among the User properties. The model generates SELECT u.vip FROM User u, the query passes validation and is executed, and execution fails:
Problem compiling [SELECT u.vip FROM User u].
[7, 12] The state field path 'u.vip' cannot be resolved to a valid type.
The error text, including the JPQL, is returned to the model as the tool result, and the user gets a generic "problem retrieving data" answer or a retelling of the technical error, depending on the model. The metadata still lists the attribute, so the model has no reason not to try the same query again.
Expected Behavior
- Attributes that cannot be used in JPQL are either not exposed to the model at all, or are exposed in a way that makes their limitation explicit to the model, in both the compact entity summary and the detailed domain model.
- JPQL validation rejects a query that references a non-persistent attribute before execution, with guidance that tells the model to drop the attribute or use the persistent attributes it is derived from.
- The user gets a meaningful answer rather than a failed query.
Environment
Jmix version: 3.0
Bug Description
The domain-model discovery tools of the AI Tools add-on expose every attribute of an entity, including non-persistent ones declared with
@JmixPropertyon a@Transientfield or on a getter (for example, a computed full name or a calculated flag). Such attributes are listed among the regular properties in the entity summary. In the detailed domain model they carrypersistent: false, but nothing explains to the model what the flag means, and JPQL validation does not check it.As a result, the model treats the attribute as a regular column, puts it into the query, the query passes validation and is executed, and the execution fails because the attribute does not exist in the database.
Attributes with
@InstanceNameon a getter without@JmixPropertyare not affected: they are not part of the metamodel and are not exposed at all.Steps To Reproduce
User:Current Behavior
aitls_getAvailableEntitieslistsvipamong theUserproperties. The model generatesSELECT u.vip FROM User u, the query passes validation and is executed, and execution fails:The error text, including the JPQL, is returned to the model as the tool result, and the user gets a generic "problem retrieving data" answer or a retelling of the technical error, depending on the model. The metadata still lists the attribute, so the model has no reason not to try the same query again.
Expected Behavior