Skip to content

Add ExecuteDMLStatement Java action to the OQL module#24

Open
passalaqua wants to merge 12 commits intomasterfrom
dux-697-add-execute-dml-statement-java-action
Open

Add ExecuteDMLStatement Java action to the OQL module#24
passalaqua wants to merge 12 commits intomasterfrom
dux-697-add-execute-dml-statement-java-action

Conversation

@passalaqua
Copy link
Contributor

Expose a new executeDML method in the OQL class that accepts a query string and returns the number
of affected rows.

Introduce a new OQLParameterBinder class that iterates over the provided parameters and invokes
the appropriate overloaded setVariable method on the OQL statement.

See #22, but now rebased and in a non-fork branch.

passalaqua and others added 6 commits March 11, 2026 13:52
* Still without any custom user code.
* Expose a new `executeDML` method in the OQL class
that accepts a query string and returns the number
 of affected rows.

* Introduce a new `OQLParameterBinder` class that
iterates over the provided parameters and invokes
the appropriate overloaded `setVariable` method on
the OQL statement.

* Adjust modeler version to `11.6.0` in
`environment.gradle` configuration file.

* Introduce OQLParameterBinder to rout the request
to the correct overloading SetVariable method that
 sets the query parameter.
* To cover the DML exection with and without
parameter.
private static boolean fitsInInt(Number n) {
// Only meaningful when n is integral; for non-integral types this returns false
if (n instanceof Byte || n instanceof Short || n instanceof Integer) return true;
if (n instanceof Long) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like discussed, in this case we should just bind as double

}

// Exact types first (to avoid accidental widening)
if (value instanceof BigDecimal) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be a lot better to make this into a switch statement

Thats possible since java 21. Since this will be for exclusively for mendix 11+, i think we change our target language level and use java 21 features instead of only 11. Community commons module also already targets 21.

@passalaqua passalaqua force-pushed the dux-697-add-execute-dml-statement-java-action branch from 772a0f7 to d67c6dc Compare March 13, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants