1.

 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-2.5.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
     <!-- 配置哪些包下的类需要自动扫描 -->
     <context:component-scan base-package="com.sanqing"/>    

     <!-- 这里的jun要与persistence.xml中的 <persistence-unit name="jun" transaction-type="RESOURCE_LOCAL">
     中的name值要一致,这样才能找到相关的数据库连接
      -->
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
          <property name="persistenceUnitName" value="jun"/>
    </bean>
    <!-- 配置事物管理器 -->
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
         <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>
    <!-- 配置使用注解来管理事物 -->
    <tx:annotation-driven transaction-manager="transactionManager"/>

 </beans>

2.

 package com.sanqing.po;

 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
 import javax.persistence.Table;
 @Entity @Table(name="tb_customer")
 public class Customer {            //客户信息类
     @Id @Column(length=20)
     private String customerNO;    //客户编号
     @Column(length=15)
     private String customerName;//客户名称
     @Column(length=15)
     private String phone;        //客户电话
     @Column(length=30)
     private String address;        //客户地址
     @Column(length=15)
     private String relationman;    //客户联系人
     @Column(length=30)
     private String otherInfo;    //其他信息
     public Customer(){}
     public Customer(String customerNO) {
         this.customerNO = customerNO;
     }
     public String getCustomerNO() {
         return customerNO;
     }
     public void setCustomerNO(String customerNO) {
         this.customerNO = customerNO;
     }

     public String getCustomerName() {
         return customerName;
     }
     public void setCustomerName(String customerName) {
         this.customerName = customerName;
     }

     public String getPhone() {
         return phone;
     }
     public void setPhone(String phone) {
         this.phone = phone;
     }

     public String getAddress() {
         return address;
     }
     public void setAddress(String address) {
         this.address = address;
     }

     public String getRelationman() {
         return relationman;
     }
     public void setRelationman(String relationman) {
         this.relationman = relationman;
     }

     public String getOtherInfo() {
         return otherInfo;
     }
     public void setOtherInfo(String otherInfo) {
         this.otherInfo = otherInfo;
     }
 }

3.

 package com.sanqing.po;

 import java.util.Date;

 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;

 @Entity @Table(name="tb_order")
 public class Order {            //订单信息类
     @Id @Column(length=10)
     private String orderNO;        //订单编码
     @ManyToOne(cascade=CascadeType.REFRESH)
     @JoinColumn(name="customerNO")
     private Customer customer;    //客户
     @ManyToOne(cascade=CascadeType.REFRESH)
     @JoinColumn(name="productNO")
     private Product product;    //产品
     @Column(length=10)
     private int quantity;        //产品数量
     @Temporal(TemporalType.DATE)
     private Date orderTime;        //订单的时间
     @Column(length=50)
     private String otherInfo;    //其他信息
     public String getOrderNO() {
         return orderNO;
     }
     public void setOrderNO(String orderNO) {
         this.orderNO = orderNO;
     }

     public Customer getCustomer() {
         return customer;
     }
     public void setCustomer(Customer customer) {
         this.customer = customer;
     }

     public Product getProduct() {
         return product;
     }
     public void setProduct(Product product) {
         this.product = product;
     }

     public int getQuantity() {
         return quantity;
     }
     public void setQuantity(int quantity) {
         this.quantity = quantity;
     }

     public Date getOrderTime() {
         return orderTime;
     }
     public void setOrderTime(Date orderTime) {
         this.orderTime = orderTime;
     }

     public String getOtherInfo() {
         return otherInfo;
     }
     public void setOtherInfo(String otherInfo) {
         this.otherInfo = otherInfo;
     }
 }

4.

 package com.sanqing.po;

 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;

 @Entity @Table(name="tb_product")
 public class Product {                //产品信息类
     @Id @Column(length=15)
     private String productNO;        //产品编号
     @ManyToOne(cascade=CascadeType.REFRESH)
     @JoinColumn(name="producttypeNO")
     private ProductType productType;//产品类型
     @Column(length=20)
     private String productName;        //产品名称
     @Column(length=20)
     private String producingArea;    //产品所在区域
     @Column(length=20)
     private String productOwner;    //产品所有者
     @Column(length=20)
     private String unit;            //产品单位
     @Column
     private double price;            //产品价格
     @Column
     private int quantity;            //产品数量
     @Column(length=50)
     private String otherInfo;        //其他信息

     public String getProductNO() {
         return productNO;
     }
     public void setProductNO(String productNO) {
         this.productNO = productNO;
     }

     public String getProductName() {
         return productName;
     }
     public void setProductName(String productName) {
         this.productName = productName;
     }

     public String getProducingArea() {
         return producingArea;
     }
     public void setProducingArea(String producingArea) {
         this.producingArea = producingArea;
     }

     public String getProductOwner() {
         return productOwner;
     }
     public void setProductOwner(String productOwner) {
         this.productOwner = productOwner;
     }

     public String getUnit() {
         return unit;
     }
     public void setUnit(String unit) {
         this.unit = unit;
     }

     public double getPrice() {
         return price;
     }
     public void setPrice(double price) {
         this.price = price;
     }

     public int getQuantity() {
         return quantity;
     }
     public void setQuantity(int quantity) {
         this.quantity = quantity;
     }

     public String getOtherInfo() {
         return otherInfo;
     }
     public void setOtherInfo(String otherInfo) {
         this.otherInfo = otherInfo;
     }

     public ProductType getProductType() {
         return productType;
     }
     public void setProductType(ProductType productType) {
         this.productType = productType;
     }
 }

5.

 package com.sanqing.po;

 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;

 @Entity @Table(name="tb_producttype")
 public class ProductType {            //产品类别信息
     private String producttypeNO;    //产品类别编号
     private String producttypeName;    //产品类别名称
     public ProductType(){}            //默认构造方法
     public ProductType(String producttypeNO) {//自定义构造方法
         this.producttypeNO = producttypeNO;
     }
     @Id @Column(length=15)
     public String getProducttypeNO() {//获得产品类别编号
         return producttypeNO;
     }
     public void setProducttypeNO(String producttypeNO) {//设置产品类别编号
         this.producttypeNO = producttypeNO;
     }
     @Column(length=20)
     public String getProducttypeName() {//获得产品类别名称
         return producttypeName;
     }
     public void setProducttypeName(String producttypeName) {//设置产品类别名称
         this.producttypeName = producttypeName;
     }
 }

6.

 package com.sanqing.po;

 import java.util.Date;

 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;

 @Entity  @Table(name="tb_quotation")
 public class Quotation {            //报价信息类
     @Id @Column(length=15)
     private String quotationNO;        //报价编号
     @Column(length=15)
     private String quotationMan;    //报价人
     @Temporal(TemporalType.DATE)
     private Date quotationTime;        //报价时间
     @Column(length=50)
     private String otherInfo;            //其他信息
     @ManyToOne(cascade=CascadeType.REFRESH)
     @JoinColumn(name="productNO")
     private Product product ;        //产品
     @ManyToOne(cascade=CascadeType.REFRESH)
     @JoinColumn(name="customerNO")
     private Customer customer;        //客户

     public String getQuotationNO() {
         return quotationNO;
     }
     public void setQuotationNO(String quotationNO) {
         this.quotationNO = quotationNO;
     }

     public String getQuotationMan() {
         return quotationMan;
     }
     public void setQuotationMan(String quotationMan) {
         this.quotationMan = quotationMan;
     }

     public Date getQuotationTime() {
         return quotationTime;
     }
     public void setQuotationTime(Date quotationTime) {
         this.quotationTime = quotationTime;
     }

     public String getOtherInfo() {
         return otherInfo;
     }
     public void setOtherInfo(String otherInfo) {
         this.otherInfo = otherInfo;
     }

     public Product getProduct() {
         return product;
     }
     public void setProduct(Product product) {
         this.product = product;
     }

     public Customer getCustomer() {
         return customer;
     }
     public void setCustomer(Customer customer) {
         this.customer = customer;
     }
 }

7.

 package com.sanqing.po;

 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
 import javax.persistence.Id;
 import javax.persistence.Table;

 @Entity @Table(name="tb_user")
 public class User {                //用户信息类
     @Id @Column(length=18)
     private String username;    //用户名
     @Column(length=18)
     private String password;    //用户密码
     @Column
     private int grade;            //用户级别

     public String getUsername() {
         return username;
     }

     public void setUsername(String username) {
         this.username = username;
     }

     public String getPassword() {
         return password;
     }

     public void setPassword(String password) {
         this.password = password;
     }

     public int getGrade() {
         return grade;
     }

     public void setGrade(int grade) {
         this.grade = grade;
     }
 }

JavaWeb项目开发案例精粹-第6章报价管理系统-06po层的更多相关文章

  1. JavaWeb项目开发案例精粹-第6章报价管理系统-05Action层

    0. <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC &quo ...

  2. JavaWeb项目开发案例精粹-第6章报价管理系统-07View层

    1. 2.back_index.html <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT= ...

  3. JavaWeb项目开发案例精粹-第6章报价管理系统-04Service层

    1. package com.sanqing.service; import com.sanqing.dao.DAO; import com.sanqing.po.Customer; /** * 客户 ...

  4. JavaWeb项目开发案例精粹-第6章报价管理系统-03Dao层

    1. package com.sanqing.dao; import java.io.Serializable; import java.util.LinkedHashMap; import com. ...

  5. JavaWeb项目开发案例精粹-第6章报价管理系统-002辅助类及配置文件

    1. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www ...

  6. JavaWeb项目开发案例精粹-第6章报价管理系统-001需求分析及设计

    1. 2. 3. 4. 5. 6.

  7. JavaWeb项目开发案例精粹-第2章投票系统-006view层

    1.index.jsp <%@ page language="java" import="java.util.*" pageEncoding=" ...

  8. JavaWeb项目开发案例精粹-第2章投票系统-004action层

    1. package com.sanqing.action; import java.util.UUID; import com.opensymphony.xwork2.ActionSupport; ...

  9. JavaWeb项目开发案例精粹-第2章投票系统-003Dao层

    1. package com.sanqing.dao; import java.util.List; import com.sanqing.bean.Vote; import com.sanqing. ...

随机推荐

  1. ubuntu 入门

    ubuntu 系统设置不全sudo apt-get install ubuntu-desktop uget aria2:下载工具http://www.xitongzhijia.net/xtjc/201 ...

  2. iOS JsonModel 的使用

    本文转自:http://blog.csdn.net/smking/article/details/40432287 下面讲一下JSONModel的使用方法. @inteface MyModel : J ...

  3. 【三石jQuery视频教程】01.图片循环展示_再次重发

    之前的文章,由于在博文的底部放有微信公众号的缘故,被管理员判定为: 您好,您的这篇博文内容本身没什么问题,但是,在博文底部存在推广信息内容.... 你们也没告知到底是哪条触犯了博客园的规矩,我就把底部 ...

  4. OAF_开发系列16_实现OAF与XML Publisher整合

    http://wenku.baidu.com/link?url=y2SFKHP5qqn4bl_iNeqLGjXsTvhyFuhkMraIbWZdTXbzcv0vTefrZFFBDWie0cAAKuTw ...

  5. 【HDU 2160】母猪的故事

    题 Description 话说现在猪肉价格这么贵,著名的ACBoy 0068 也开始了养猪生活.说来也奇怪,他养的猪一出生第二天开始就能每天中午生一只小猪,而且生下来的竟然都是母猪. 不过光生小猪也 ...

  6. [转载]如何申请淘宝app_key、app_secret、SessionKey?

    不知道如何申请淘宝开发平台的App Key?其实申请App key很简单,主要了解申请步骤以及各个App key的数据阶段状态就可以了!下面由淘客帝国为您做详细图文讲解!申请比较简单,不过为了新手能够 ...

  7. WinForm C#全局错误捕捉处理【整理】

    static class Program { /// <summary> /// 应用程序的主入口点. /// </summary> [STAThread] static vo ...

  8. UVa 1395 (最小生成树) Slim Span

    题意: 规定一棵生成树的苗条度为:最大权值与最小权值之差.给出一个n个顶点m条边的图,求苗条度最小的生成树. 分析: 按照边的权值排序,枚举边集的连续区间[L, R]的左边界L,如果这些区间刚好满足一 ...

  9. jQuery输入框提示自动完成插件 autocomplete

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  10. C++ delete 和 delete []

    C++ delete 和 delete [] 简单结论: new delete new [] delete []   文章 : 对 delete [] 的声明 void operator delete ...