Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

findByKey() finds only primary keys?

107137Jun 18 2002
I want to use the findByKey() method to check if a specific value is already in the database. I use the following code snippet to do this:
String Nr = "SearchStringPart1";
AttributeListImpl al = new AttributeListImpl();
al.setAttribute("UniqueKeyPart1",new Number(1));
al.setAttribute("UniqueKeyPart2",Nr);
Key myKey = myViewObject.createKey(al);
Row[] rows = myViewObject.findByKey(myKey,2);
If I run this code snippet "rows[]" will be empty, even if the queried data does exist.

UniqueKeyPart1 and UniqueKeyPart2 form together a unique key in the database and they are marked as "Keys" in the Attribute Settings of "myViewObject". However, they are no primary keys.

If I change the code snippet to query the primary key I do get some results:
AttributeListImpl al = new AttributeListImpl();
al.setAttribute("PrimaryKey",new Number(13));
Key myKey = myViewObject.createKey(al);
Row[] rows = myViewObject.findByKey(myKey,2);
Question:
---------
Is it possible, that "findByKey" can only find primary keys? This is not documented in the documentation.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 19 2002
Added on Jun 18 2002
8 comments
761 views