[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] JPA:how to avoid join table for ManyToOne
|
I suggest creating a read-only Basic mapping on A for b's id and querying on
that column instead.
Something like:
SELECT o from A o where o.b_id = 1
Zarar Siddiqi wrote:
Instead of the @JoinTable use @JoinColumn(name="b").
On Tue, Apr 21, 2009 at 1:44 PM, <cn.thesky@xxxxxxxxx> wrote:
hello all,
for example
@Entity
class A {
@Id
long a_id;
String a_name;
@ManyToOne
@JoinTable(name="b_id")
B b;
}
@Entity
class B {
@Id
int b_id ;
String b_name;
}
jpa query:
SELECT o from A o where o.b.id = 1
I hope the generated sql like:
select a_id,a_name from A where b = 1;
but the eclipselink generated the following sql
select t0.a_id,t0.a_name from A t0, B t1 where t0.b = t1.b_id AND t1.b_id
= 1
This is, my table A is very very large table , maybe more than 40m rows;
table B is small, 1,000 - 10,000rows. I can't afford the performance lost
due to any join operation for table A .
Any suggestion except native sql? I hope all place like this should not
use join table, for the sake of performance.
thanks
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users