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

patch request update extra field #438

Open
mbossX opened this issue Feb 9, 2025 · 2 comments
Open

patch request update extra field #438

mbossX opened this issue Feb 9, 2025 · 2 comments
Labels

Comments

@mbossX
Copy link

mbossX commented Feb 9, 2025

entity like:

@MappedSuperclass
@Data
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseEntity implements Serializable {
    @Id
    @UniqueID()
    @GeneratedValue(generator = "UniqueIdGenerator")
    private Long id;

    @Comment("创建时间")
    @Column(updatable = false, nullable = false)
    @CreatedDate
    private Long createTime;

    @Comment("修改时间")
    @Column(updatable = false, nullable = false)
    @LastModifiedDate
    private Long updateTime;
}


@Entity(name = "Role")
@Table(name = "sys_role")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Role extends BaseEntity {
    @Comment("父级ID")
    @Column(nullable = false, columnDefinition = "bigint DEFAULT 0")
    private Long pid = 0L;

    @Comment("角色名称")
    @Column(length = 32, nullable = false)
    private String name;

    @Comment("备注")
    private String comment;
}

patch request with body {"comment":"111"}

desired sql log is:

update sys_role update comment = ? where id = ?        ["111",  xxxx]

but get sql log is:

update sys_role 
    set
        comment=?,
        name=?,
        pid=? 
    where
        id=?
2025-02-09T11:58:51.825+08:00 TRACE 18916 --- [           main] o.h.o.j.bind                             : binding parameter (1:VARCHAR) <- [111]
2025-02-09T11:58:51.825+08:00 TRACE 18916 --- [           main] o.h.o.j.bind                             : binding parameter (2:VARCHAR) <- [test role]
2025-02-09T11:58:51.825+08:00 TRACE 18916 --- [           main] o.h.o.j.bind                             : binding parameter (3:BIGINT) <- [0]
2025-02-09T11:58:51.825+08:00 TRACE 18916 --- [           main] o.h.o.j.bind                             : binding parameter (4:BIGINT) <- [642814482726981]

why extra filed name and pid is updated. (extra field value not changed)

@wog48
Copy link
Contributor

wog48 commented Feb 15, 2025

I assume you are using JPAExampleCUDRequestHandler, which is only for rapped prototyping.

@wog48 wog48 added the analysis label Feb 15, 2025
@mbossX
Copy link
Author

mbossX commented Feb 19, 2025

so I need implement my custom CUDRequestHandler to fit this?

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

No branches or pull requests

2 participants