Sorry for the TAGS. I thought the forum accepted them and they would make things easier to read. The repost follows:
I have written a simple query using CMP2.0 (JBOSS 3.0.1) and it is throwing javax.ejb.ObjectNotFoundException: No such entity! without any reason. The problem is that the entity being searched for does exist, and so does its record in the database.
Is this a bug? Or is there something new that needs to be specified in a find method that weren't required in JBoss previous versions?
The code is the following:
The deployment descriptor follows:
<ejb-ql><![CDATA[SELECT OBJECT(b) FROM Building b WHERE b.alias = ?1]]></ejb-ql>
The generated SQL is:
SELECT t0_b.COD_BUILDING FROM BUILDING t0_b WHERE t0_b.ALIAS = ?
When I take the generated SQL fragment and run it against the Oracle Database, it returns just the desired COD_BUILDING (which is the primery key). The colunm BUILDING.ALIAS is UNIQUE (doesn't have duplicated values).
Does anybody know how to fix it?
Luis JB Soeiro
Are you sure you are connecting to you oracle database? You can try turning the log level upto trace to see the parameters being set and the results loaded. If that doesn't work try adding some debug statements to JDBCAbstractQueryCommand.