Apparently creating a custom query destroys both your project AND your studio application
Here I am, creating a custom query just like the one I've seen attached to the Quotation business object in one of Bonita Studio 7.10.0's many sample projects. My custom query is literally a copy&paste of the sample custom query, which does not generate any errors:
-Bonita Studio's custom findFromRequest query
-My custom findFromLesionado query
When I deploy the sample project, no errors are displayed whatsoever: the project works just fine and I can experiment as much as I like with the features it provides
When I deploy my project, however...
(Translation: "Some processes cannot be enabled using the current configuration. Please, configure said processes or select another environment (Enterprise only).")
Naturally, I head over to these processes to look for any sign of things not working as they should: absolutely zero error notifications are provided, even after refreshing the validation list.
A bit frustrated by this, I decide to go back on my own steps and delete what I think is the cause for this error: my custom query. But to my surprise, I'm still getting the same deployment error even after deleting all traces of the query, and so far the only way out of this situation I've been able to find has been to uninstall the Studio application, reinstall, and import my project again.
Yes, I have tried to add the query without the LIKE parameter, and I've also tried looking for the "selectedLesionado" object's persistenceId instead of its "nombre" attribute, to no avail.
I'm not as interested in finding a way to solve this as I'm interested in finding a reason for getting this huge roundhouse kick to the teeth from the Studio application. Why would the sample query work perfectly while mine, a carbon copy, not only doesn't work but corrupts my whole Bonita Studio?
Were you able to deploy your processes before you created the custom query?
I've already experienced this issue once, and I've never been able to reproduce it in order to try to fix it.
Here is the issue:
When you deploy a custom query with an invalid content (example: use double quote instead of simple quote), an error is detected by hibernate. Sometimes, it seems that hibernate enters in a rollback loop because of the previous error -> Then, no matter what you are asking hibernate to do (like deploy a process), he will first retry to perform the operation in error: deploy the invalid query, and fail again. That's why you still have error even if the invalid query has been deleted.
We have upgraded to hibernate 5 in Bonita 7.11 (the summer 2020 release), it will hopefully fix those weird behaviors.
If you experience this kind of issue again, you do not have to reinstall completely your Bonita Studio, you only have to reset the engine database. To do so, click on the menu server -> restart web server, and check the option 'drop engine database'.
You can also delete the database manually, by going into your project in the file system (right click on the project -> show in system explorer) and deleting the folder 'h2_database'.
Concerning your use case, be aware that the sql LIKE keyword doesn't work well with Bonita. To perform a like request, you should
- Put something like that in your custom query: WHERE b.attribute like :parameter
- Call this query through a java API (in a script), with the parameter %value%
I Hope I answered your questions,
I see. Well, while it is certainly a pity that there's currently no way to prevent this error, we've recently (and unfortunately) had the chance to test your method of solving the issue, as we had encountered an "UndeclaredThrowableException" loop upon editing some files. But we solved it following your advice!
Restarting the web server and dropping the engine database didn't seem to work at first, but the second method did. We manually deleted the 'h2_database' folder and, although it took some time for the Studio to deploy our project afterwards, in the end everything was working as if nothing had ever happened.
Regarding the query, we'll look into your proposed solution and I'll comment again as soon as I've managed to get my query to work (it's not a big priority for us at the moment, we're currently dealing with more substantial components of our application).
Thank you for your help, you've saved us a day or two of rebuilding our project. I can only hope that Bonita 7.11 brings us a definitive solution, but at least now we won't have to lose so much progress.