Skip to content

How can I use @SoftDelete on an annotation #2505

@baozi-2019

Description

@baozi-2019

I want to make a new annotation to replace @softdelete.

package org.baozi.bs.common.db.anntations;

import jakarta.enterprise.inject.Stereotype;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.hibernate.annotations.SoftDelete;
import org.hibernate.annotations.SoftDeleteType;

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Stereotype
@SoftDelete(
    columnName = "deleted",
    strategy = SoftDeleteType.DELETED
)
public @interface LogicDelete {
}

When I add my annotation on entity, it's no use.

@Entity
@SoftDelete(columnName = "deleted", converter = DeleteFieldConverter.class)
@LogicDelete
@Table(name = "user")
public class UserEntity {

    @Id
    @SnowId
    @Column(name = "id")
    private Long id;


    @Column(name = "username")
    private String username;

    // ...getters and setters

}

How can I use @softdelete on an annotation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions