This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes finder method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "finder method" Watch "finder method" New topic

finder method

Devaki Nihar

Joined: Apr 30, 2005
Posts: 20
I am using Orion2.0 App server.I used CMP entitybeans.I have written one finder method
My code is like this
1) in TestUserHome home interface of entity beans
public Collection findByFirstName(String firstName)throws FinderException , RemoteException;
2) in ejb-jar.xml
<!------ And more other -->
SELECT OBJECT(u) FROM TestUser AS u WHERE u.firstName=?1

3) I am calling the finder method from session bean as
///////Other required stuff here
Collection testUsers =testUserHome.findByFirstName(name);
////////other stuff

And when i execute the application then it gets all the records regardless of the finding by the passed name
But when i do entry in server specific orion-ejb-jar.xml as

<entity-deployment name="TestUser" location="TestUser" wrapper="TestUserHome_EntityHomeWrapper2"
table="TestUser" data-source="jdbc/MyDS" isolation="uncommitted" max-tx-retries="2">
<finder-method query="$firstName = $1">

but both cases i get one warning when i start my server as
WARNING: Unused <query> tag found in <entity> 'TestUser', method name 'findByFirstName(java.lang.String)'
Stephan Staeheli

Joined: Jul 22, 2002
Posts: 27
Hi there

I never worked with orion, so I just have to guess: Is there some kind of 'orion-cmp-rdbms-jar.xml' that maps the cmp-fields to real database fields? In WebLogic I have such thing and there I also have to register my finder methods. Have a look in your docu for 'cmp-rdbms', hope this helps.

Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
This may be useful.

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Devaki Nihar

Joined: Apr 30, 2005
Posts: 20
There is no any config file such like 'orion-cmp-rdbms-jar.xml'
And already i have mapped all the cmp fields in deployment descriptor.
THE APPLICATION IS WORKING FINE but i am getting the warning at server startup.
subject: finder method
It's not a secret anymore!