Hi all,
I've a little problem with hibernate accessing an entity that has more than one Secondary Table.
My Entity is defined like this:
Code:
@Entity
@Table(name="tab1")
@SecondaryTables({
@SecondaryTable(name="tab2"),
@SecondaryTable(name="tab3")
})
public MyObject {
@Id
int id;
@Basic
int field1;
@Column(table="tab2")
int field2;
@Column(table="tab3")
int field3;
...
...
}
the generated query is like this one:
Code:
SELECT .... FROM tab1 left outer join tab2 on .... left outer join tab3 on ....
This sintax is not supported by the database I'm using (MSAccess. I know it's not officially supported but I cannot change it)
In order to have a working query it should be necessary to enclose the joins in parenthesis, like this:
Code:
SELECT .... FROM ((tab1 left outer join tab2 on ....) left outer join tab3 on ....)
Is it possible to obtain this behaviour, even extending some hibernate class?
I've also tried adding
@org.hibernate.annotations.Table(appliesTo="tab1", fetch=FetchMode.SELECT) annotation but the resulting query is not changed.
I was expecting to have 3 different selects instead of one with outer joins but this didn't appened.
Any Hint?
Best Regards
Fabio
Hibernate version:
3.3GA