aspose file tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes quick question on primary key Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » EJB Certification (SCBCD/OCPJBCD)
Reply Bookmark "quick question on primary key" Watch "quick question on primary key" New topic
Author

quick question on primary key

Bob Walker Jr
Ranch Hand

Joined: Jun 02, 2003
Posts: 46
EJB spec says that a primary key must be a legal Value Type in RMI-IIOP. How do I know what are legal Value Types in RMI-IIOP? Is there a list somewhere?
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
Yeah, that one bugs everybody... the fact that the spec requires you to adhere to RMI-IIOP types, but does not include the details.
So, I have two points on this:
1) On the exam, you DO have to know that you are required to assume RMI-IIOP. But, when answering questions -- you can treat RMI-IIOP as though it were plain RMI over JRMP. In other words, if you know the rules for RMI, you'll be able to answer the questions correctly. WITH ONE EXCEPTION: you DO have to know about PortableRemoteObject.narrow() for the remote home stub.
2) But for the curious... the restrictions that RMI-IIOP adds over RMI over JRMP are quite subtle (although they could kill you if they came up)... I pulled this directly from the RMI-IIOP programmer's guide:

* Don't inherit the same method name into a remote interface more than once from different base remote interfaces.
*Be careful when using names that differ only in case. The use of a type name and a variable of that type whose name differs from the type name only in case is supported. Most other combinations of names that differ only in case are not supported.
There are other restrictions, but I think these are really the two big issues that matter for EJB. But as I said, this is not on the exam
cheers,
Kathy
Bob Walker Jr
Ranch Hand

Joined: Jun 02, 2003
Posts: 46
thanks, Kathy. So can primitive types be used as a primary key or you have to use wrappers?
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
You definitely have to have a wrapper... everything requiring a primary key is of type Object
cheers,
Kathy
Forrest Xu
Ranch Hand

Joined: Nov 16, 2002
Posts: 92
a legal Value Type in RMI-IIOP could be Serializable Type, primary wrapper object and then what? does it include remote type?
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
Howdy -- a legal type for args and return types for Remote methods in EJB could be Serializable, primitives, Remote objects, and arrays or collections of any of those, even if you use type Collection, which is *not* Serializable, but all of the collections implementation classes in the API are Serializable.
Almost. There used to be a little problem, don't know if they've fixed it, that for some STUPID reason the collection returned from the values() method on a hashtable (maybe hashmap too, can't remember) was NOT in fact Serializable. This brought our little project to its knees once, 'till someone looked at the source code for the hashtable/map class and found that the collection returned was from an implementation of an inner class that was not, to our horror, Serializable!
OK, sorry for the getting a little excited there. But if you use any of the known, exposed collections in J2SE, there's no problem.
cheers,
Kathy
Forrest Xu
Ranch Hand

Joined: Nov 16, 2002
Posts: 92
Hi,Kathy,
Thanks,
Now I think I understand it very much.
 
 
subject: quick question on primary key
 
Threads others viewed
Primary Key Class
Coffe Cream on EB - Mistakes/Doubt #2
ques about primary key class
p.363-mock exam q.5
Entity bean primary class
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture