summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/EmployeeAddressMOUniBean.java
diff options
context:
space:
mode:
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/EmployeeAddressMOUniBean.java')
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/EmployeeAddressMOUniBean.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/EmployeeAddressMOUniBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/EmployeeAddressMOUniBean.java
new file mode 100644
index 0000000..be74d18
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/entity/uni/many_to_one/EmployeeAddressMOUniBean.java
@@ -0,0 +1,42 @@
+package examples.entity.uni.many_to_one;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import examples.entity.uni.many_to_one.interfaces.EmployeeAddressMOUni;
+
+@Stateless
+public class EmployeeAddressMOUniBean implements EmployeeAddressMOUni {
+ @PersistenceContext
+ EntityManager em;
+
+ public void doSomeStuff() {
+ BusinessAddress a = new BusinessAddress();
+ a.setCity("Huntington Station");
+ a.setZipcode("11746");
+
+ Employee e = new Employee();
+ e.setName("Micah Silverman");
+ e.setAddress(a);
+ em.persist(e);
+
+ e = new Employee();
+ e.setName("Tes Silverman");
+ e.setAddress(a);
+ em.persist(e);
+
+ e = new Employee();
+ e.setName("Shaina Silverman");
+ e.setAddress(a);
+ em.persist(e);
+ }
+
+ public List getEmployees() {
+ Query q = em.createQuery("SELECT e FROM Employee e");
+ return q.getResultList();
+ }
+}