create table users (
username varchar(50) not null primary key,
password varchar(120) not null,
enabled number (1,0) not null
);
Mainly I need to declare enabled number (1,0) not null in Hibernate.
Nobody helped me with the above question but no issues I myself found the answer after a lot many thing and searches.
There are many solutions already uploaded on stack overflow but they respected MY-SQL. But I wanted it for Oracle. Now I have the Solution.
Please find it below. Maybe someone needs it like me.
Kindly Note: Oracle doesn't support TINYINT as well as 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;
}