Greetings, here is my problem:
I've two CMP Entity related with a CMR. Let's call them E1 and E2 and the relation is from E1 to E2 of one-to-many type.
The ejb E1 and E2 have the field ID1 as the field to make the relation field, in E1 I have the field e2s as the Collection for the relation and in E2 I have the field ID2. (I hope to be clear). In the database I have two tables, T1 mapped to E1 and T2 mapped to E2, in T1 and T2 I have a column named ID1 that makes the relation between the two table and in T2 the column ID2. In T1 and T2 I have other columns of course.
Now I make in E1 a finder method to obtain a Collection of E1 object that are related in E2 in this way:
SELECT DISTINCT OBJECT(a) FROM E1 AS a, IN (a.e2s) AS b
and the query works fine without problems. If in the table T1 I have the records (1),(2),(3) and in T2 the records (1,1),(1,2),(2,1),(2,3) the finder returns the entities 1 and 2, it's all correct.
But if I make in E1 a finder method to obtain a Collection of E2 object that are related in E2 gived a value for the field ID2 in this way:
SELECT DISTINCT OBJECT(a) FROM E1 AS a, IN (a.e2s) AS bWHERE b.ID2 = ?1
I cannot deploy on the application server (JBoss 3.2.1) because an error in the query (expected something different from b.ID2 in the where clause and the error for the parser starts at the position of the "?")
Where is the error ?
Thanks in advance for the precious help.
I've solved the problem. All the ID fields were BigDecimals and ejb-ql doesn't support this datatype. I've changed it with Integer and all works fine.