从java实体类创建postgresql

b1zrtrql  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(316)

下面提供了java实体类:

@Setter
@Getter
@Entity
@ToString
@Table(name = "usage_type")
@AllArgsConstructor
@NoArgsConstructor
public class UsageType extends Auditable<UUID> {

    @Id
    @GeneratedValue
    @Column(name = "id")
    private UUID id;

    @ToString.Exclude
    @JsonManagedReference
    @OneToMany(mappedBy = "usageType", cascade = CascadeType.ALL)
    private Set<Product> products;

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

    @Column(name = "plural_name")
    private String pluralName;

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

    @Column(name = "unit_name")
    private String unitName;

    @Column(name = "status")
    private UsageStatus status;

    @Column(name = "decimal_places")
    private Integer decimalPlaces;

    @Column(name = "roundingStrategy")
    private RoundingStrategy roundingStrategy;
}

这是实体的相应模型类:

@Getter
@Setter
public class UsageTypeDto {

    private UUID id;

    private String name;

    private String pluralName;

    private String description;

    private String unitName;

    private UsageStatus status;

    private Integer decimalPlace;

    private RoundingStrategy roundingStrategy;
}

我们可以看到,这个类与产品实体类有关系,我在代码库中有很多这样的实体类。
有没有一种自动化的方法可以让我在postgres中运行的这个实体的sqlcreatetable语句?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题