Hi, we are using a lot of functionality from BaseORMService, and most of it is very handy
Recently we discovered the Dynamic finders. Example is:
But in some cases these methods caused mapping errors, telling me my existing Domain component did not exist.
If I used a findWhere method from the same orm library things were OK, like
For most other components things were fine, so we had to find differences. In this case we were using multiple datasources, and dynamic finders failed only on the non-default datasources.
I investigated the source code and saw the dynamic finders use HQL, wile the findwhere methods only use EntityLoad. In HQL you have to specify a datasource option if not using a default datasource, so this coud be solved in this way
myObj=orm.findbyName("Domain","mycompany.nl",{datasource="mydatasourcename"});
Maybe documentation can be improved a little, so it is clear that dynamic finders are implemented in a different way compared to the findwhere methods? Specifying this datasource in every call is a workable solution (we do the same with HQL) but not very desirable,
Or another solution could be:
The findDynamically method already has an options struct for HQL options and an EntityName argument. From this entityname you could determine if a datasource was specified in the Entity definition. If so, it could be added to the options struct.
For now, we returned to the findwhere methods when using non standard datasources. Other syntax, other technique, but same results for exact matches.
Kind regards,
Wil