JpaRepository 在 spring 引导 2.6.5 中抛出异常

JpaRepository throwing exception in spring boot 2.6.5

我刚刚升级到 2.6.5 并且出现了一个新问题,这在 2.6.4 中没有发生。我有以下实体:

@Entity
@Table(name="tblInterfaceConnection")
@NoArgsConstructor
@EqualsAndHashCode(of="uuid")
@Getter
@Setter
@ToString
public class Connection implements Serializable 
{
@Serial
private static final long serialVersionUID = 8426179776707246860L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(nullable = false, unique = true)
private String uuid = UUID.randomUUID().toString();

@Column(nullable = false)
private String name;

@Column(nullable = false)
private Integer port;

@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 20)
private ConnectionType type;

@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 6)
private SocketType socketType;

@Enumerated(EnumType.STRING)
@Column(nullable = false, length = 12)
private ConnectionStatus status;

public Connection(String name, Integer port, ConnectionType type, SocketType socketType, ConnectionStatus status) 
{
    this.name = name;
    this.port = port;
    this.type = type;
    this.socketType = socketType;
    this.status = status;
}
}

相应repo中的这个查询方法在2.6.4中完美运行:

List<Connection> findAllByNameContainsAndStatusEqualsOrderByNameAscPortAsc(String name, ConnectionStatus status);

升级到 2.6.5 后我得到这个异常:

java.lang.IllegalArgumentException: Parameter value [\] did not match expected type [java.lang.String (n/a)]

有什么想法吗?

这是一个 Hibernate 错误:https://hibernate.atlassian.net/browse/HHH-15142 由于回归仅在 Hibernate 版本 5.6.6 中引入,您可以通过将 Hibernate 降级到 5.6.5

来避免它