This content has been marked as final.
Show 1 reply
-
1. Re: need examples on custom findBy methods in Jboss 3.0 late
dsundstrom Jun 26, 2002 7:41 PM (in response to gzhong)I suggest read the free EJB 2.0 (PDF) book available at the serverside.com or get a copy of the O'Reilly EJB book.
EJB-QL is based on the abstract schema of the entity beans. The from clause uses the abstract-schema-name declared for the entity in the ejb-jar.xml file (not the table name), and the where clause uses the cmp-field name. Your query should look something like this:
[pre]
<ejb-ql>
SELECT OBJECT(a)
FROM vector_user a
WHERE a.username = ?1 AND a.password = ?2
</ejb-ql>
[/pre]
Notice I added the alias declaration a, and used that alias in the where clause. This query assumes that the abstract-schema-name vector_user is valid and it has username and password cmp fields.