Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using CMP, How to Write EJB QL

JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a beginner in EJB. I am using CMP and want to write EJB QL strings in the ejb-jar.xml file. I think that I understand the basic EJB QL syntax. However, my database consists of many tables, and I cannot sort out the mapping.
To give a very simple example, there are about 15 tables in my database "EXPENSES". And the "LOGIN" table in the "EXPENSES" database has all the user names and passwords. I read in a user name, and there is
public Enumeration findByUserName( String name )
throws FinderException, RemoteException;
method defined in the UserHome interface. How do I map this findByUserName(...) method to the "LOGIN" table (i.e. I want to search the read-in user name in the "LOGIN" table)? In the ejb-jar.xml, do I write:
SELECT * FROM LOGIN WHERE username = 'name'
Please help.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic