Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java.lang.NullPointerException: Cannot invoke "Object.hashCode()" because "key" is null] #6200

Closed
bai-xuan opened this issue May 23, 2024 · 2 comments

Comments

@bai-xuan
Copy link

mp 版本:3.5.6
jdk:
openjdk version "17.0.11" 2024-04-16
OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9)
OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode, sharing)

实体类:

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;

@DaTa
@EqualsAndHashCode(callSuper = false)
@TableName("test")
public class User extends Model {

private static final long serialVersionUID = 1L;

/**
 * id
 */
@TableId(value = "id", type = IdType.AUTO)
private Long id;

/**
 * 用户名
 */
@TableField("user_name")
private String userName;

/**
 * 用户名
 */
@TableField("nick_name")
private String nickName;

/**
 * 性别
 */
@TableField("sex")
private Integer sex;

/**
 * 头像
 */
@TableField("head_image")
private String headImage;

/**
 * 头像缩略图
 */
@TableField("head_image_thumb")
private String headImageThumb;

/**
 * 个性签名
 */
@TableField("signature")
private String signature;
/**
 * 密码(明文)
 */
@TableField("password")
private String password;

/**
 * 最后登录时间
 */
@TableField("last_login_time")
private Date lastLoginTime;

/**
 * 创建时间
 */
@TableField("created_time")
private Date createdTime;

/**
 * 注册来源:0本系统,1gitee,2github
 */
@TableField("register_from")
private Integer registerFrom;

/**
 * oauth认证结果
 */
@TableField("oauth_src")
private String oauthSrc;

/**
 * 账号类型:0正常,1匿名
 */
@TableField("account_type")
private Integer accountType;

/**
 * 匿名id
 */
@TableField("anonymou_id")
private String anonymouId;

@TableField("last_login_ip")
private String lastLoginIp;

@Override
protected Serializable pkVal() {
    return this.id;
}

}

如何出现的,问题代码:
User user = lambdaQuery().eq(User::getAnonymouId, req.getAnonymouId()).one();
image

@nieqiurong
Copy link
Contributor

复现工程示例.

@bai-xuan
Copy link
Author

已找到问题,引入了低版本的mybatis-plus-extension包

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants