I'm having an issue porting an EJB 2.1 entity been that has some jboss-ql in it that looks like this:
select object(o) from SomeBean o where o.isThisIt = true
This jboss-ql is transforming into this sql statement:
SELECT t0_o.ID FROM SOME_TABLE t0_o WHERE (t0_o.IS_THIS_IT = (1=1))
The way this used to work with JBoss 4 was you defined a <type-mapping> in your datasource something like "Oracle9i". This then mapped back to a cmp configuration in standardjbosscmp-jdbc.xml. In there, for the "Oracle9i" configuration, the <true-mapping> is defined as 1 so the query which is generated looks like this:
SELECT t0_o.ID FROM SOME_TABLE t0_o WHERE (t0_o.IS_THIS_IT = 1)
The query that JBoss 7 is generating doesn't work.
I tried adding a <type-mapping> to my datasource configuration in the standalone-full.xml file, but it doesn't parse. I tried also putting that under a <metadata> tag as well, but that doesn't parse either.
If I crack open the cmp module jar file "jboss-as-cmp-7.1.1.Final.jar" I can see the standardjbosscmp-jdbc.xml file is there, but it doesn't seem to use it?
I was "somewhat" able to figure this one out. If I add <datasource-mapping>Oracle9i</datasource-mapping> to the <defaults> section of my jbosscmp-jdbc.xml file, it works as expected. If you had multiple datasources of different types you would have to determine an alternate solution.