我找到了与 MY-SQL 相关的解决方案。我的要求是 oracle.what 我应该在 POJO class 中写入以通过休眠获取以下模式结构

I found Solutions related to MY-SQL. my requirement is for oracle.what should i write in the POJO class to get the below schema structure by hibernate

create table users (
    username varchar(50) not null primary key,
    password varchar(120) not null,
    enabled number (1,0) not null
);

主要是我需要在Hibernate中声明enabled number (1,0) not null

没有人帮我解决上面的问题,但没有问题我自己在经过很多事情和搜索后找到了答案。

已经在 stack overflow 上上传了很多解决方案,但他们尊重我的-SQL。 但我想要它用于 Oracle。现在我有了解决方案。

请在下方查找。也许有人像我一样需要它。

敬请 注意: Oracle 不支持 TINYINT 和 BOOLEAN。

@Entity
@Table(name="users")
public class UserRegistration {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="username")
    private String username;
    private String password;
    @Column(nullable = false, columnDefinition = "NUMBER(1)")
    @Type(type = "org.hibernate.type.NumericBooleanType")
    @ColumnDefault("0")
    private boolean enabled;
}