Question on SQL with literals

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Question on SQL with literals

Lars-Fredrik Smedberg
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 [hidden email], and destroy all copies of this
message and any attachments.

_______________________________________________
eclipselink-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/eclipselink-dev
Reply | Threaded
Open this post in threaded view
|

Re: Question on SQL with literals

Lars-Fredrik Smedberg
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 <[hidden email]> 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 [hidden email], 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 [hidden email], and destroy all copies of this
message and any attachments.

_______________________________________________
eclipselink-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/eclipselink-dev
Reply | Threaded
Open this post in threaded view
|

Re: Question on SQL with literals

Lars-Fredrik Smedberg
Is the question below posted to the correct mailing list?

Any information on the question would be of great help.

Best regards
Lars-Fredrik 

On Mon, Aug 31, 2020 at 11:15 AM Lars-Fredrik Smedberg <[hidden email]> wrote:
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 <[hidden email]> 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 [hidden email], 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 [hidden email], 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 [hidden email], and destroy all copies of this
message and any attachments.

_______________________________________________
eclipselink-dev mailing list
[hidden email]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/eclipselink-dev