File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Finder Methods

 
chin josei
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hii..
I have a CMP bean whichz having couple of finder methods.
The finder methods always returns the first row in the table.
Irrespective of whatever input i give, say for example..
findByPrimaryKey(new Key(""XX"))
findByPrimaryKey(new Key("YY"))
boh returns the same first row in the table.
Now this problem happens only if I use a Primary Class of my own.
If I use a String Object as my Primary Key itz working perfectly.
what mistake am i doing?
thanx in advance
chin
 
rani bedi
Ranch Hand
Posts: 358
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show th code for ejbFindByPrimaryKey()
and the key object class.
 
trevershick
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What App server are you using?
Weblogic?
What's your deployment descriptor like?

Originally posted by chin josei:
hii..
I have a CMP bean whichz having couple of finder methods.
The finder methods always returns the first row in the table.
Irrespective of whatever input i give, say for example..
findByPrimaryKey(new Key(""XX"))
findByPrimaryKey(new Key("YY"))
boh returns the same first row in the table.
Now this problem happens only if I use a Primary Class of my own.
If I use a String Object as my Primary Key itz working perfectly.
what mistake am i doing?
thanx in advance
chin

 
Matt Midcap
Sheriff
Posts: 440
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"trevershick",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
[This message has been edited by Matt Midcap (edited July 03, 2001).]
 
vijay shepunde
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Matt Midcap:
"trevershick",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
[This message has been edited by Matt Midcap (edited July 03, 2001).]

Normally it happens when you use findByPrimaryKey method against a Non-Unique database fields, ie if there are more than one records by same name/value, it always returns first record
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic