We were running ActiveRecord 1.0.3 and our generated sql was ANSI-
style. We have since decided to move to using NHibernate directly
using 2.1. The generated sql is now Oracle's old-style sql with the
(+) symbol in the where clause. This causes bad sql to be generated if
you have a where clause in your mapping file (plus I just don't like
it either).
<bag name="IndividualDTOs" access="property" table="TBL_SUBR_INDV"
lazy="true" inverse="true" cascade="none" order-by="INDV_ID"
where="MAINT_CODE !=99">
<key column="SUBR_FK" />
<one-to-many
class="DCS2000.Subscriber.ObjectDataModel.IndividualDTO,
DCS2000.Subscriber.ObjectDataModel" />
</bag>
This leads to sql like so:
SELECT ...
FROM SMTEST2.TBL_SUBR_INDV individual0_, SMTEST2.TBL_SUBR
subscriber1_, SMTEST2.TBL_SUBR_INDV_ADDR orm_indivi2_
WHERE individual0_.SUBR_FK=subscriber1_.SUBR_PKS(+)
and individual0_.SUBR_INDV_PKS=orm_indivi2_.SUBR_INDV_FK(+) and
(orm_indivi2_.MAINT_CODE !(+)= 99) AND individual0_.SUBR_INDV_PKS=?
Of course, the !(+) code is the problem.
I went back and looked at my old ActiveRecord sql output and the joins
were ANSI sql. I upgraded the old project to ActiveRecord 2.0 and it
also generated the old-style sql.
I had read that the != is not ANSI compliant, but rather you should
use <>. I tried updating my mapping file to use <>, but ran into
parsing problems upon reading the mappings. I tried MAINT_CODE<![CDATA
[<>]]>99 to no success.
So, my questions are:
1) Why did the style of sql change?
2) Can I force NH to generate the ANSI compliant style?
3) How do I specify <> in a mapping file?
We are using Oracle9iDialect and I have tried using both the Oracle
and Microsoft drivers.
Thanks,
scott
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---