Skip to content

expand fail for v2.0.0 #236

Closed
Closed
@mbossX

Description

@mbossX
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Role implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Column(length = 32, nullable = false)
    private String name;

    @Column(length = 128)
    private String comment;

    @Column(columnDefinition = "text")
    private String permissions;

    @OneToMany(mappedBy = "role")
    private List<User> users;
}

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Column(length = 32)
    private String name;

    private String email;

    @Column(length = 11, unique = true, nullable = false)
    private String username;

    @Column(length = 16, nullable = false)
    private String password;
    
    @Column(nullable = false, columnDefinition = "tinyint DEFAULT 0")
    private Integer status;

    @Column(name = "role_id")
    private Integer roleId;
    // @EdmIgnore
    // @Column(name = "role_id", precision = 10, insertable = false, updatable = false)
    // private Integer roleId;

    @ManyToOne
    @JoinColumn(name = "role_id", referencedColumnName = "id", insertable = false, updatable = false)
    private Role role;
}

when browser http://localhost:8081/odata/v1/Users(1)?$expand=role
return
Could not determine recommended JdbcType for tech.jiyun.odata.entity.Role
use v2.0.0 and springboot 3.1.5

but same code work fine at v1.1.1 and springboot 2.7.17

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions