3 Replies Latest reply on Apr 23, 2004 6:05 AM by ahardy66

    CMP finder methods

    ahardy66 Novice


      Am I right in thinking that I have to return a Collection from all of my finder methods except findByPrimaryKey()?

      In the DB I have a users table with a userId and a loginName. Both have unique constraints on them, but only the Id is the primary key.

      If I want to create a findByUserName() then does it have to return a collection, out of which I must fish the bean?

      Or can I do it some other way and return just the one bean? I'm using xdoclet and this isn't working:

      * @ejb.finder
       * description="get user by name"
       * signature="org.gargantus.user.UserLocal findByUserName(String name)"
       * query="SELECT OBJECT(u) FROM user AS u WHERE u.userName = ?1"