Skip to content

Return Type with @DataType Is Incorrectly Marked as Invalid #346

@xterao

Description

@xterao

Describe the bug
In the following code, the return type common.Salary triggers the error:

The return type common.Salary is invalid

However, Salary is defined as follows:

@DataType
public record Salary(BigDecimal value) {
}

This type should be treated the same as types annotated with @Domain, and its use should be allowed as a valid return type.

Note
The impact of @DataType-annotated domain records is effectively limited to @select, @function, and @procedure methods.

In the case of @update or @insert:

When the sqlFile=true option is set, if the parameter type is not an immutable Entity class, the return type must be int.

Additionally, when using the @returning option, the parameter must be an Entity type as well.

Therefore, returning a domain class in these cases is not a realistic or supported use case.

However, it is valid to use a @DataType-annotated class as a parameter in sqlFile=true statements.
To accommodate this, additional logic should be added to suppress error highlighting when such a class is used as a parameter.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions