| Author |
Multiple Primary Keys
|
tan kian
Ranch Hand
Joined: Apr 09, 2004
Posts: 40
|
|
how do i do this in j2ee? for example,i want sid,pid and cid to be the primary keys. do i specify something like this in the localHome? public EnrolLocal create(String sid,String currentsem,String pid,String cid) throws CreateException,RemoteException; public EnrolLocal findByPrimaryKey(String sid) throws FinderException; public EnrolLocal findByPrimaryKey(String pid) throws FinderException; public EnrolLocal findByPrimaryKey(String cid) throws FinderException; or like this: public EnrolLocal findSid(String sid) throws FinderException; public EnrolLocal findPid(String pid) throws FinderException; public EnrolLocal findCid(String cid) throws FinderException;
|
 |
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
|
nope, your complex key will be an object
|
 |
tan kian
Ranch Hand
Joined: Apr 09, 2004
Posts: 40
|
|
so should it be like this? public EnrolLocal create(String sid,String currentsem,String pid,String cid,MixedKey multipleKey) throws CreateException,RemoteException; public EnrolLocal findByPrimaryKey(MixedKey multipleKey) throws FinderException; and multipleKey will be something like this: public MixedKey(String sid,String pid,String cid) [ September 10, 2005: Message edited by: tan kian ]
|
 |
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
to be sure, you may have to check the book, in addition, you will need to learn how to create the complex key object, there are methods that must be in the class, e.g. i think one method is on hash
|
 |
 |
|
|
subject: Multiple Primary Keys
|
|
|