zoukankan      html  css  js  c++  java
  • springboot jpa 复合主键

    https://blog.csdn.net/wyc_cs/article/details/9031991

    创建一个复合主键类

    public class LevelPostMultiKeysClass  implements Serializable{
    private Integer levelId;
    private Integer postId;

    public LevelPostMultiKeysClass() {
    }

    public LevelPostMultiKeysClass(Integer levelId, Integer postId) {
    this.levelId = levelId;
    this.postId = postId;
    }

    @Override
    public int hashCode() {
    final int PRIME = 31;
    int result = 1;
    result = PRIME * result + ((levelId == null) ? 0 : levelId.hashCode());
    result = PRIME * result + ((postId == null) ? 0 : postId.hashCode());
    return result;
    }

    @Override
    public boolean equals(Object obj){
    if(this == obj){
    return true;
    }
    if(obj == null){
    return false;
    }
    if(getClass() != obj.getClass()){
    return false;
    }

    final LevelPostMultiKeysClass other = (LevelPostMultiKeysClass)obj;
    if(levelId == null){
    if(other.levelId != null){
    return false;
    }
    }else if(!levelId.equals(other.levelId)){
    return false;
    }
    if(postId == null){
    if(other.postId != null){
    return false;
    }
    }else if(!postId.equals(other.postId)){
    return false;
    }
    return true;
    }

    }




  • 相关阅读:
    linux系统缓存机制
    信号“未决”与“阻塞”
    异步I/O
    Unix下五种IO模型
    【设计模式
    【设计模式
    【设计模式
    【设计模式
    【设计模式
    【设计模式
  • 原文地址:https://www.cnblogs.com/xiqoqu/p/10008202.html
Copyright © 2011-2022 走看看