On the language that I know, RPG... You can use multiple keys and find retrieve the values of the record.
Like for table. I can select keys lolo and apple to retrieve the value of sex witch is F. Howerver I could not find some functionality that is like this in OPENJPA.. find() can only use one key? Is there something like find(names.class,:"LOLO","Apple") where keys are F_NAME and L_NAME?
Names
F_NAME L_NAME Sex
LOLO Apple F
Ben Coke M
While reading jpa, usually the table has P_ID
P_ID F_NAME L_NAME Sex
1 LOLO Apple F
2 Ben Coke M
To retrieve the record lolo apple, i need to use this code..
Names name = em.find(Names.class, 1);
How will you know the sex if the given value is F_NAME? and L_NAME? In SQL you can just say select * from Names where F_NAME = Lolo , L_NAME = "Apple" and it will output
P_ID F_NAME L_NAME Sex
1 LOLO Apple F
From that you can say that Sex = F.
Like i want to know if lolo apple is male or female, I will search lolo apple on the database... not P_ID = 1. How would i konw what is the P_ID of Lolo Apple.
Hopefully you get what I mean.. Thanks.
Or maybe in another part of the equation, on JPA, how to you retrieve the record to be updated while not knowing yet the P_ID (Primary key) like you only know the first name and last name?