zoukankan      html  css  js  c++  java
  • mongpdb中document的复合主键申明方式

    package yaycrawler.dao.domain;
    
    import javax.persistence.*;
    import java.sql.Blob;
    
    @Entity
    @IdClass(QrtzJobDetailsIds.class)
    @Table(name = "qrtz_job_details")
    public class QrtzJobDetails implements java.io.Serializable {
        
        /*
            现在复合主键(sched_name job_name job_group都需要加上@Id并且需要单独创建类,然后再当前类加上@IdClass(QrtzJobDetailsIds.class) 【QrtzJobDetailsIds自行定义】 )
        */
    
        /** 版本号 */
        private static final long serialVersionUID = 840552323049001278L;
        
        /** schedName */
        @Id
        @Column(name = "sched_name", unique = true, nullable = false, length = 120)
        private String schedName;
    
        /** jobName */
        @Id
        @Column(name = "job_name", unique = true, nullable = false, length = 200)
        private String jobName;
    
        /** jobGroup */
        @Id
        @Column(name = "job_group", unique = true, nullable = false, length = 200)
        private String jobGroup;
    
        /** description */
        @Column(name = "description", nullable = true, length = 250)
        private String description;
    }

    复合主键定义的类

    public class QrtzJobDetailsIds implements Serializable{
    
        private static final long serialVersionUID = 7431247025727743159L;
    
        public String schedName;
        public String jobName;
        public String jobGroup;
    
        public QrtzJobDetailsIds() {
        }
    
        public QrtzJobDetailsIds(String schedName, String jobName, String jobGroup) {
            this.schedName = schedName;
            this.jobName = jobName;
            this.jobGroup = jobGroup;
        }
      ..................      
    }
    人生没有彩排,每天都是现场直播!
  • 相关阅读:
    一些经验
    倍增(在线)求LCA
    IDA*算法——骑士精神
    A*算法——第K短路
    (持续更新)一些黑科技和技巧
    逆元
    方便人类——信息学训练专用库
    PHP单点登陆
    PHP 中运用 elasticsearch
    PHP斐波那契数列
  • 原文地址:https://www.cnblogs.com/northern-light/p/10497692.html
Copyright © 2011-2022 走看看