We have the following JPQL:
Select distinct sys.ipAddress from SystemLog sys where sys.ipAddress is not null and sys.ipAddress is not empty
And this generates the following mysql statement.
select distinct systemlog0_.ipAddress as col_0_0_ from SystemLog systemlog0_ where ( systemlog0_.ipAddress is not null ) and ( exists ( select systemlog0_.id from SystemLog systemlog0_ ) )
This obviously does not work and returns an empty string instead of deleting it. However, I am looking for something like this:
select distinct ipAddress from SystemLog where ipAddress is not null and ipAddress <> '';
However, I cannot understand why our jpa request does not generate anything like this. Any ideas?
java mysql orm jpa
Shervin asgari
source share