Closed OssNass closed 2 years ago
Is the problem with UUID? I don't remember adding any specific code for handling UUID objects, so I'm not sure if that works. Where does the exception occur?
Also, I don't think Jinq can handle JPQL.isIn() with streams passed in from outside the query. I think it can handle Lists of objects passed in from outside the query, but you can't pass in entire streams. If you want to use streams in JPQL.isIn(), you must actually create the stream in the query itself:
proxyStream.where((proxy, source)->{
var proxies = source.stream(ProxyEntity.class).where(item -> item.getClientId().equals(id))
.select(ClientPerProxyEntity::getProxyId);
return JPQL.isIn(proxy.getId(),proxies);
})
or something like that
then why it worked in the second example ?
Could be the existence of source
is the key?
I think you are right, I will try and tell you of the results
I have no idea. It's been a while since I wrote the code for that, so maybe it does work. I can't really remember the details without digging through the code. But I don't think it should from what I can remember. Does that code appear inside another query?
Like I said, it might be the UUID issue. Which line does the exception occur from?
The exception occurs in this line:
proxyStream.where(proxy->JPQL.isIn(proxy.getId(),proxies)
Yeah, then it must be an issue with passing a stream into the query. Jinq's streams are not serializable. The stream has to be created inside the query itself, so that Jinq can analyze it.
I think you can also just call toList() to convert the stream into a list, and then you can pass the list into the query. But that will execute that subquery separately from the main query, which might be slow depending on what you're doing.
The problem is, after a certain 2700 items in the list SQL server refuses to perform the match
Yes, you will then need to run the whole query on the database. So you will have to construct the stream inside the query itself so that Jinq can analyze it and construct a database query from it.
Yes, you will then need to run the whole query on the database. So you will have to construct the stream inside the query itself so that Jinq can analyze it and construct a database query from it.
Working on it, I have a kind of abstraction layer for allowing me to dynamically construct where condition using Jinq in Spring Boot, I have done the moving from Where
to WhereWithSource
validating now
It worked, However, I need now validate every other old Where
with the new WhereWithSource
, I have a long day ahead of me.
Thanks
I have 2 entities:
Now when I apply the following code:
It says
But when I apply the following code:
It works perfectly?