[netbeans-samples~samples:36] init - source code for CustomerBook finished project

  • From: ken_g@kenai.com
  • To: commits@netbeans-samples.kenai.com
  • Subject: [netbeans-samples~samples:36] init - source code for CustomerBook finished project
  • Date: Mon, 15 Jun 2009 14:51:12 +0000

Project:    netbeans-samples
Repository: samples
Revision:   36
Author:     ken_g
Date:       2009-06-15 14:51:10 UTC
Link:       
http://kenai.com/projects/netbeans-samples/sources/samples/revision/36

Log Message:
------------

init - source code for CustomerBook finished project

Added Paths:
------------
NB67/Web/CustomerBook/src/java/ejb/DiscountCode.java
NB67/Web/CustomerBook/src/java/ejb/MicroMarket.java
NB67/Web/CustomerBook/src/java/web/CustomerDetails.java
NB67/Web/CustomerBook/src/java/ejb/Customer.java


Diffs:
------
Index: NB67/Web/CustomerBook/src/java/ejb/Customer.java
===================================================================
--- NB67/Web/CustomerBook/src/java/ejb/Customer.java    (revision 0)
+++ NB67/Web/CustomerBook/src/java/ejb/Customer.java    (revision 36)
@@ -0,0 +1,185 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package ejb;
+
+import java.io.Serializable;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+
+/**
+ *
+ * @author nb
+ */
+@Entity
+@Table(name = "customer")
+@NamedQueries({@NamedQuery(name = "Customer.findAll", query = "SELECT c FROM 
Customer c"), @NamedQuery(name = "Customer.findByCustomerId", query = "SELECT 
c FROM Customer c WHERE c.customerId = :customerId"), @NamedQuery(name = 
"Customer.findByName", query = "SELECT c FROM Customer c WHERE c.name = 
:name"), @NamedQuery(name = "Customer.findByAddressline1", query = "SELECT c 
FROM Customer c WHERE c.addressline1 = :addressline1"), @NamedQuery(name = 
"Customer.findByAddressline2", query = "SELECT c FROM Customer c WHERE 
c.addressline2 = :addressline2"), @NamedQuery(name = "Customer.findByCity", 
query = "SELECT c FROM Customer c WHERE c.city = :city"), @NamedQuery(name = 
"Customer.findByState", query = "SELECT c FROM Customer c WHERE c.state = 
:state"), @NamedQuery(name = "Customer.findByPhone", query = "SELECT c FROM 
Customer c WHERE c.phone = :phone"), @NamedQuery(name = "Customer.findByFax", 
query = "SELECT c FROM Customer c WHERE c.fax = :fax"), @NamedQuery(name = 
"Customer.
 findByEmail", query = "SELECT c FROM Customer c WHERE c.email = :email"), 
@NamedQuery(name = "Customer.findByCreditLimit", query = "SELECT c FROM 
Customer c WHERE c.creditLimit = :creditLimit")})
+public class Customer implements Serializable {
+    private static final long serialVersionUID = 1L;
+    @Id
+    @Basic(optional = false)
+    @Column(name = "customer_id")
+    private Integer customerId;
+    @Column(name = "name")
+    private String name;
+    @Column(name = "addressline1")
+    private String addressline1;
+    @Column(name = "addressline2")
+    private String addressline2;
+    @Column(name = "city")
+    private String city;
+    @Column(name = "state")
+    private String state;
+    @Column(name = "phone")
+    private String phone;
+    @Column(name = "fax")
+    private String fax;
+    @Column(name = "email")
+    private String email;
+    @Column(name = "credit_limit")
+    private Integer creditLimit;
+    @JoinColumn(name = "discount_code", referencedColumnName = 
"discount_code")
+    @ManyToOne(optional = false)
+    private DiscountCode discountCode;
+    @JoinColumn(name = "zip", referencedColumnName = "zip_code")
+    @ManyToOne(optional = false)
+    private MicroMarket zip;
+
+    public Customer() {
+    }
+
+    public Customer(Integer customerId) {
+        this.customerId = customerId;
+    }
+
+    public Integer getCustomerId() {
+        return customerId;
+    }
+
+    public void setCustomerId(Integer customerId) {
+        this.customerId = customerId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAddressline1() {
+        return addressline1;
+    }
+
+    public void setAddressline1(String addressline1) {
+        this.addressline1 = addressline1;
+    }
+
+    public String getAddressline2() {
+        return addressline2;
+    }
+
+    public void setAddressline2(String addressline2) {
+        this.addressline2 = addressline2;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getFax() {
+        return fax;
+    }
+
+    public void setFax(String fax) {
+        this.fax = fax;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public Integer getCreditLimit() {
+        return creditLimit;
+    }
+
+    public void setCreditLimit(Integer creditLimit) {
+        this.creditLimit = creditLimit;
+    }
+
+    public DiscountCode getDiscountCode() {
+        return discountCode;
+    }
+
+    public void setDiscountCode(DiscountCode discountCode) {
+        this.discountCode = discountCode;
+    }
+
+    public MicroMarket getZip() {
+        return zip;
+    }
+
+    public void setZip(MicroMarket zip) {
+        this.zip = zip;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 0;
+        hash += (customerId != null ? customerId.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        // TODO: Warning - this method won't work in the case the id fields 
are not set
+        if (!(object instanceof Customer)) {
+            return false;
+        }
+        Customer other = (Customer) object;
+        if ((this.customerId == null && other.customerId != null) || 
(this.customerId != null && !this.customerId.equals(other.customerId))) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "ejb.Customer[customerId=" + customerId + "]";
+    }
+
+}
Index: NB67/Web/CustomerBook/src/java/ejb/DiscountCode.java
===================================================================
--- NB67/Web/CustomerBook/src/java/ejb/DiscountCode.java        (revision 0)
+++ NB67/Web/CustomerBook/src/java/ejb/DiscountCode.java        (revision 36)
@@ -0,0 +1,95 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package ejb;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Collection;
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+/**
+ *
+ * @author nb
+ */
+@Entity
+@Table(name = "discount_code")
+@NamedQueries({@NamedQuery(name = "DiscountCode.findAll", query = "SELECT d 
FROM DiscountCode d"), @NamedQuery(name = "DiscountCode.findByDiscountCode", 
query = "SELECT d FROM DiscountCode d WHERE d.discountCode = :discountCode"), 
@NamedQuery(name = "DiscountCode.findByRate", query = "SELECT d FROM 
DiscountCode d WHERE d.rate = :rate")})
+public class DiscountCode implements Serializable {
+    private static final long serialVersionUID = 1L;
+    @Id
+    @Basic(optional = false)
+    @Column(name = "discount_code")
+    private Character discountCode;
+    @Column(name = "rate")
+    private BigDecimal rate;
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "discountCode")
+    private Collection<Customer> customerCollection;
+
+    public DiscountCode() {
+    }
+
+    public DiscountCode(Character discountCode) {
+        this.discountCode = discountCode;
+    }
+
+    public Character getDiscountCode() {
+        return discountCode;
+    }
+
+    public void setDiscountCode(Character discountCode) {
+        this.discountCode = discountCode;
+    }
+
+    public BigDecimal getRate() {
+        return rate;
+    }
+
+    public void setRate(BigDecimal rate) {
+        this.rate = rate;
+    }
+
+    public Collection<Customer> getCustomerCollection() {
+        return customerCollection;
+    }
+
+    public void setCustomerCollection(Collection<Customer> 
customerCollection) {
+        this.customerCollection = customerColl...



[netbeans-samples~samples:36] init - source code for CustomerBook finished project

ken_g 06/15/2009
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close