summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client')
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client/CompanyEmployeeClient.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client/CompanyEmployeeClient.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client/CompanyEmployeeClient.java
new file mode 100644
index 0000000..8959f37
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/bid/one_to_many/client/CompanyEmployeeClient.java
@@ -0,0 +1,44 @@
+package examples.entity.bid.one_to_many.client;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import examples.entity.bid.one_to_many.Company;
+import examples.entity.bid.one_to_many.Employee;
+import examples.entity.bid.one_to_many.interfaces.CompanyEmployeeOM;
+
+
+public class CompanyEmployeeClient {
+ public static void main(String[] args) {
+ try {
+ InitialContext ic = new InitialContext();
+ CompanyEmployeeOM ceom = (CompanyEmployeeOM)ic.lookup(CompanyEmployeeOM.class.getName());
+
+ ceom.deleteAll();
+
+ ceom.doSomeStuff();
+
+ for (Object o : ceom.getCompanies()) {
+ Company c = (Company)o;
+ System.out.println("Here are the employees for company: "+c.getName());
+ for (Employee e : c.getEmployees()) {
+ System.out.println("\tName: "+e.getName()+", Sex: "+e.getSex());
+ }
+ System.out.println();
+ }
+ System.out.println();
+
+ for (Object o : ceom.getEmployees()) {
+ Employee e = (Employee)o;
+ Company c = e.getCompany();
+
+ System.out.println("Employee: "+e.getName()+" works for: "+c.getName());
+
+ System.out.println();
+ }
+ }
+ catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file