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;
        }
        
    }
  • 相关阅读:
    Gearman分布式任务处理系统(六)跨多种环境部署
    Gearman分布式任务处理系统(五)版本介绍、安装方法和使用说明
    Gearman分布式任务处理系统(四)Gearman协议
    Gearman分布式任务处理系统(三)libevent介绍
    Java课程笔记_4
    Lesson 13-14 How often do you exercise?
    Lesson 11-12 Men and Women
    Java课程笔记_3
    Lession 9-10 Cell Phone Taboos
    Lession 5-6 When you have a cold
  • 原文地址:https://www.cnblogs.com/kisstear/p/5545948.html
Copyright © 2011-2022 走看看