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
JPAStreamer generated query isn't parametrized and possibly not optimal query.
Let's say my Entity, JPAStreamer code looks like following. I have org.hibernate.SQL as debug and hence was able to capture SQL generated.
I am not sure why the parametrized query is not getting generated in SQL see where clause userId in this case. Here the query where has and click0_.userId=1234. Which I think would create DB performance issue since each userId hardcoded in SQL, each query needs a new execution plan. Isn't there a setting to force parametrization with ? and parameter as 1234 as in example below. Is this something that needs fix in library?
Using Java 8, Spring 5, Spring boot 2.3.3.RELEASE, hibernate5. We use MSSQL DB.
POM JPAStreamer dependency:
com.speedment.jpastreamer
jpastreamer-core
1.0.1
Entity: @DaTa @entity @table(name="mydb.dbo.click")
public class Click implements Serializable { @id @column(name = "pk_id", updatable = false)
private int id;
select
distinct Click
from
Click as Click
where
(
Click.clickDateTime>:param0
)
and (
Click.userId=1234
) */ select
distinct TOP 200 click0_.pk_id as pk_id1_22_,
click0_.createdatetime as md_creat2_22_,
click0_.userId as fk_user12_22_
from
click click0_
where
click0_.createdatetime>?
and click0_.userId=1234
The text was updated successfully, but these errors were encountered:
JPAStreamer generated query isn't parametrized and possibly not optimal query.
Let's say my Entity, JPAStreamer code looks like following. I have org.hibernate.SQL as debug and hence was able to capture SQL generated.
I am not sure why the parametrized query is not getting generated in SQL see where clause userId in this case. Here the query where has and click0_.userId=1234. Which I think would create DB performance issue since each userId hardcoded in SQL, each query needs a new execution plan. Isn't there a setting to force parametrization with ? and parameter as 1234 as in example below. Is this something that needs fix in library?
Using Java 8, Spring 5, Spring boot 2.3.3.RELEASE, hibernate5. We use MSSQL DB.
POM JPAStreamer dependency:
com.speedment.jpastreamer
jpastreamer-core
1.0.1
Entity:
@DaTa
@entity
@table(name="mydb.dbo.click")
public class Click implements Serializable {
@id
@column(name = "pk_id", updatable = false)
private int id;
}
JPAStreamer code
/** want to find clicks by user within hours provided */
public List getCLicksByUserId(int userId, int hoursAgo) {
Generated SQL:
select
distinct Click
from
Click as Click
where
(
Click.clickDateTime>:param0
)
and (
Click.userId=1234
) */ select
distinct TOP 200 click0_.pk_id as pk_id1_22_,
click0_.createdatetime as md_creat2_22_,
click0_.userId as fk_user12_22_
from
click click0_
where
click0_.createdatetime>?
and click0_.userId=1234
The text was updated successfully, but these errors were encountered: