I used Example last project with database:Oracle. And now in current project I used MSSQL. But I find there is something different performence in using Example between MSSQL and Oracle.
I config a many-to-one association in two table.
Code:
table foo column: id, name
table bar column:id, foo_id, bar_name
My java search code
Code:
foo.setName("11");
bar.setFoo(foo);
bar.setBarName("22");
...
crit.add(Example.create(foo));
crit.list();
In Oracle, I find hibernate will generate sql like this:
select xxx from bar inner join foo on bar.foo_id = foo.id where bar.bar_name=? and foo.name=?
But in MSSQL, hibernate will generate sql like this:
select xxx frm bar out join foo on bar.foo_id = foo.id where bar.bar_name=?
It doesn't include any conditions on parent table(in this case, foo.name) and use out join instead of inner join in Oracle.
My question is:Is it correct action in Hibernate?How to represent same function like in Oracle?