zoukankan      html  css  js  c++  java
  • hibernate自动建表

    x'ml配置文件

            <!-- 扫描所有实体类 -->
            <property name="packagesToScan">
                <list>
                    <value>com.fit.core.pojo</value>
                </list>
            </property>


    //关键diamagnetic
    <prop key="hibernate.hbm2ddl.auto">update</prop>

    实体类

    package com.fit.core.pojo;
    
    import java.util.Date;
    
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    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="tbl_interview")
    public class TblInterview {
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private Long id;
        
        @ManyToOne
        @JoinColumn(name="party_worker")
        private User partyWorker;
        
        @Temporal(TemporalType.DATE)
        @Column(name="start_date", length=30, nullable=true)
        private Date startDate;    
        
        @Column(name="request_content", nullable=true)
        private String requestContent;
        
        @Column(length=50, nullable=true)
        private String topic;
    
        public Long getId() {
            return id;
        }
    
        public void setId(Long id) {
            this.id = id;
        }
    
        public User getPartyWorker() {
            return partyWorker;
        }
    
        public void setPartyWorker(User partyWorker) {
            this.partyWorker = partyWorker;
        }
    
        public Date getStartDate() {
            return startDate;
        }
    
        public void setStartDate(Date startDate) {
            this.startDate = startDate;
        }
    
        public String getRequestContent() {
            return requestContent;
        }
    
        public void setRequestContent(String requestContent) {
            this.requestContent = requestContent;
        }
    
        public String getTopic() {
            return topic;
        }
    
        public void setTopic(String topic) {
            this.topic = topic;
        }
        
    }
  • 相关阅读:
    php javascript
    在线支付接口之PHP支付宝接口开发
    作业9 最长公共子序列
    第十二章 税制的设计
    第十一章 公共物品和公共资源
    第十章 外部性
    第九章 应用:国际贸易
    作业8 矩阵乘法链
    第八章 应用:赋税的代价
    第七章 消费者、生产者与市场效率
  • 原文地址:https://www.cnblogs.com/kisstear/p/5545948.html
Copyright © 2011-2022 走看看