aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Multiple Primary Keys Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Multiple Primary Keys" Watch "Multiple Primary Keys" New topic
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: 2061
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: 2061
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Primary Keys