Quantcast
Channel: Spring Community Forums - Data
Viewing all articles
Browse latest Browse all 297

Spring Data JPA using unnecessary JOIN for querying one single table

$
0
0
Hello,

Since Spring Data JPA 1.2.1, unnecessary joins are generated when a single table is queried, which can take 10000 times longer to execute when tables contains millions of records.
With log4jdbc we see the generated query and its execution time.

Here are "simplified" statements of the SQL statements (our table contain many more columns).

In Spring Data JPA 1.2.0 and lower, the following statement was generated :
select order0_.ID as order1_14_ from ORDER order0_ where order0__.CUSTOMER_ID=123456
Execution time : 2 ms

In Spring Data JPA 1.2.1 and higher, the following statement is generated :
select order0_.ID as order1_14_ from ORDER order0_ left outer join CUSTOMER customer1_ on order0_.CUSTOMER_ID=customer1_.ID where customer1_.ID=123456
Execution time : 18842 ms

Is there an option to disable this behaviour ?

Environment :
WebLogic 12.1.1
Spring 3.2.2
Hibernate 3.6.10
Sybase 12.5.4 with JConnect JDBC driver 7.07

Thanks in advance,

metatech

Viewing all articles
Browse latest Browse all 297

Trending Articles