I have a need to map the @org.hibernate.annotations.ColumnDefault("true")
to BIT default 1
in generated SQL schema. Is there anyway other than adding a @Column(columnDefinintion="BIT default 1")
I'm using SQL Server 2008 Dialect and hibernate 5.3.26 and XPAND for code generation.
I have tried using @org.hibernate.type.BooleanType
also but it did not work.
Done some debugging in hibernate core also and in org/hibernate/cfg/Ejb3Column.java:625
where it takes the @ColumnDefault annotation value and later set it as it is without mapping in org/hibernate/mapping/Table.java:561
. May be I have missed something. Is there anyway to override this functionality?
Where is the SQL type and default value mapping happens in schema generation? classes methods etc.
Any help would be grateful.
CodePudding user response:
Using the below combination resolved the issue.
@org.hibernate.annotations.Type(type = "org.hibernate.type.BooleanType")
@org.hibernate.annotations.ColumnDefault(value = "1")