Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Native query uses PreparedStatement?

A dev can correct me if I'm wrong, but I believe by definition when
you use setParameter you're going to be using parameter binding and
hence prepared statements. The default value is to do parameter
binding in eclipselink, see
http://wiki.eclipse.org/Optimizing_the_EclipseLink_Application_(ELUG)#How_to_Use_Parameterized_SQL_.28Parameter_Binding.29_and_Prepared_Statement_Caching_for_Optimization
for more information.

Also keep in mind  a lot of the optimization there is going to be
handled in your data source definition, for instance in one my apps i
use c3p0 to define connection pooling and there are a ton of options
for configuring maximum amount of prepared statements to keep, etc.

./tch



On Thu, Aug 5, 2010 at 6:07 AM, Shashikant Kale
<Shashikant.Kale@xxxxxxxxxxxxxxxx> wrote:
> Hello,
>
>
>
> I had a doubt if native queries are parsed using a PreparedStatement or a
> simple Statement? We have a native query to which we have few paramaters
> which we set using setParameter on Query api after creating the query using
>
>
>
> Query q = em.createNativeQuery(“Select * from Table1 where id=?1”);
>
> q.setParameter(101L);
>
>
>
> Please let me know.
>
> Regards,
>
> Shashi
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>


Back to the top