Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] Question on SQL with literals

Looking more at this it seems like, depending on the SQL question, a named query can result in either a statement or prepared statement.
I define the query using @NamedQuery and create it using the createNamedQuery on the EntityManager.

E.g. if the sql contains a not exists clause it seems to result in a statement, removing the not exists and I get a prepared statement.

Can anyone shed some light on this so that I understand what to do to ensure it always results in prepared statements? Any configuration to "force" this?

Best regards
LF

On Thu, Aug 27, 2020 at 11:11 PM Lars-Fredrik Smedberg <itsmeden@xxxxxxxxx> wrote:
Hi

I was wondering if there is a way to force Eclipselink to use prepared statements instead of statements?
We have cases where:

- We use the entity manager to create a named query and it results in a statement
- We use the entity managers find method and it results in a prepared statement

When the generated SQL contains literals it generates to much log records for us and slows things down.

For open jpa I found a property called openjpa.hint.useliteralinsql that sounds right for me, is there something similar in Eclipselink or any other way to avoid literals in the SQL / use prepared statements?

Hope for some help on this
Best regards
Lars-Fredrik Smedberg

--
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@xxxxxxxxx, and destroy all copies of this
message and any attachments.


--
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@xxxxxxxxx, and destroy all copies of this
message and any attachments.

Back to the top