Finding entities with GORM-JPA
I’ve been having this issue for a while. Putting it off, but now I had to get my hands dirty. The findBy… methods weren’t returning any objects even though there were data fitting the specified values.
So tonight I finally took the time to take a look at it. My theory was that I could figure out what was wrong by reading the code in JpaPluginSupport.groovy, located in the GORM-JPA plugin.
Now I didn’t find out why its not working. It even looks like its not supported, but I can’t say for sure. What I did however, was find a workaround.
Instead of doing
User.findByEmail(newSaga.email)
I do
User.findWhere(email: newSaga.email)
Using the findWhere method I get results. This is the workaround I’ll go for for now.