|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--examples.passbyvalue.PassByValueExample
Pass-by-value example. This example shows how you can get and set the atributes of an Entity eBSC by value. What this means is that instead of getting/setting one attribute at a time, you can request that a local copy of all attributes be sent to you directly, in one remote call. You can then read and modify this "Value object" or local copy, and send it back in one remote call. This has tremendous performance advantages compared to accessing one attribute at a time It is also important to be able to set many attributes within a single transaction without having to begin/commit a JTS User Transaction from the client. In short, pass-by-value is really handy! Our implementation is tightly-coupled: that means that at compile time, we enforce type consistency for getting/setting attributes in the value objects. This is a great advantage over "parameter sets", or "late-binding" implementations where you pass around a set of name/value pairs: in that case, if you change the type of an attribute your client will still compile but crash at runtime. That wouldn't happen using eBSCs, since the value object would change accordingly and the client would not compile if an assigment was illegal. And in case you're wondering, our value objects are generated by Theory Center's SmartGenerator (based on a UML model), so they don't add any maintenance costs.
Customer
Constructor Summary | |
PassByValueExample()
|
Method Summary | |
void |
addCustomerInfo(Customer customer)
This method adds information to a given Customer using the CustomerValue object. |
void |
exitExample(java.lang.String message,
java.lang.Exception e)
Display the message and the exception and terminate the the program |
Customer |
findOrCreateCustomer(java.lang.String customerKey)
Finds or Creates a customer with the given customerKey. |
javax.naming.Context |
getInitialContext()
Gets an initial context for the current user, password and url. |
static void |
main(java.lang.String[] args)
Main driver. |
void |
printCustomerInfo(Customer customer)
This method prints customer information using a value object. |
void |
run()
This method runs the example. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public PassByValueExample()
Method Detail |
public void addCustomerInfo(Customer customer)
customer
- The customer we want to modifypublic Customer findOrCreateCustomer(java.lang.String customerKey)
customerKey
- the key for the customerpublic javax.naming.Context getInitialContext() throws java.lang.Exception
public static void main(java.lang.String[] args)
public void exitExample(java.lang.String message, java.lang.Exception e)
message
- The message to display upon terminatione
- The exception thrown or null if no exception was thrownpublic void printCustomerInfo(Customer customer)
customer
- the customer entitypublic void run()
|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |