I have the following case:
table A {id_a, column1, column2, column3_A} table B {id_b, id_a, column1, column2, column3_B} table C {id_c, id_b, column1, column2, column3_C} id_a, id_b and id_c are primary keys and there is a one to many relation between A and B and one to many relation between B and C. These tables are Oracle partitioned tables where the partition key in all tables is (column1,column2).
I would like to use Hibernate for DB operations but for performance reasons all underlying sql select queries should contain as additional condition the partition key, ex:
// when data should be retrieved from B table Hibernate should generate select * from B b inner join C c on b.column1=c.column1 and b.column2=c.column2 and b.id_b=c.id_b where b.id_a=? and b.column1=? and b.column2=? Please notice the additional join columns between the 2 tables.
I don't have too much experience with Hibernate and I wasn't able to resolve this situation so far. I tried to use @JoinColumns to add the additional 2 columns (column1 and column2) in the join clause but in this case I had problems during insert because I had to mark these columns as insertable=false, so they were missing from the insert query (since they are not nullable this is not possible).
Can somebody give me a hint?
|