You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a quick one that fortunately has a fix but can be added to future updates:
new RushSearch().startGroup().whereIsNotNull("user").and().whereEqual("user", user).endGroup().orderDesc("created").find(AssetModel.class);
is "user" is a relation and it happens to return null, let's say we saved AssetModel with a null user at some point, then whereIsNotNull is only searching for a table primitive named "user", the where statement looks like this:
WHERE (rush_uk_co_vicast_communityapp_model_AssetModel_rush_uk_co_vicast_communityapp_model_UserModel_user.child IS NOT NULL AND user='V8g95') and normally we should replace "user" with "rush_uk_co_vicast_communityapp_model_AssetModel_rush_uk_co_vicast_communityapp_model_UserModel_user.child" for the full query to work.
A fast fix would be to calculate the "user" relation field name in advance like this:
Hello,
First of all, thank you for this library ;)
Just a quick one that fortunately has a fix but can be added to future updates:
new RushSearch().startGroup().whereIsNotNull("user").and().whereEqual("user", user).endGroup().orderDesc("created").find(AssetModel.class);
is "user" is a relation and it happens to return null, let's say we saved AssetModel with a null user at some point, then whereIsNotNull is only searching for a table primitive named "user", the where statement looks like this:
WHERE (rush_uk_co_vicast_communityapp_model_AssetModel_rush_uk_co_vicast_communityapp_model_UserModel_user.child IS NOT NULL AND user='V8g95')
and normally we should replace "user" with "rush_uk_co_vicast_communityapp_model_AssetModel_rush_uk_co_vicast_communityapp_model_UserModel_user.child" for the full query to work.A fast fix would be to calculate the "user" relation field name in advance like this:
Map annotationCache = RushCore.getInstance().getAnnotationCache(); String userFieldName = ReflectionUtils.joinTableNameForClass(((AnnotationCache)annotationCache.get(AssetModel.class)).getTableName(), ((AnnotationCache)annotationCache.get(UserModel.class)).getTableName(), "user") + ".child";
and then insert it into the query replacing "user" to userFieldName variable.
Thank you,
Alex
The text was updated successfully, but these errors were encountered: