Hibernate version:
2.1.6
I'm using a stupid RDBMS which has a bug with alias name in Select statement.
When I use hibernate for one-to-many mapping with non-lazy initialization, this bug brings me trouble.
The generated SQL is like the following:
The generated SQL (show_sql=true):
select instances0_.FACTORY_ID as FACTORY_ID__, instances0_.ID as ID__, instances0_.ID as ID0_, instances0_.URI_KEY as URI_KEY0_, instances0_.STATE as STATE0_, instances0_.NAME as NAME0_, instances0_.SUBJECT as SUBJECT0_, instances0_.DESCRIPTION as DESCRIPT6_0_, instances0_.CONTEXT_DATA as CONTEXT_7_0_, instances0_.RESULT_DATA as RESULT_D8_0_, instances0_.FACTORY_ID as FACTORY_ID0_, instances0_.WORKFLOW_INSTANCE_ID as WORKFLO10_0_ from T_ASAP_INSTANCE instances0_ where instances0_.FACTORY_ID=?
Both FACTORY_ID__ and FACTORY_ID0_ point to the column of FACTORY_ID. But the stupid RDBMS which I use ommits the first alias name, and only the latter can be accessed from the returned ResultSet.
So Hibernate cannot get the Key for parent (one side) from the resultset of the child(many side). Then Exception occurs.
I hate the RDBMS I am using. But how can I deal with it. I have no ideas.
Anyone could give me some light?
|