Added Test Case here https://github.com/guptasujeet/hibernate-test-case-templates/commit/a41eb90526cdc8126f5a57d4289b6bbd4762adeb Table Created (notice not null, when optional = false) =========== 1) optional = true, nullable = true ----------------------------------- @ManyToOne(fetch = FetchType.LAZY, optional = true) @JoinColumn(name = "user_id", nullable = true) private UserProfile userProfile; create table UserContact ( contactId bigint not null, name varchar(255), user_id bigint, primary key (contactId) ) 2) optional = false, nullable = true ----------------------------------- @ManyToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "user_id", nullable = true) private UserProfile userProfile; create table UserContact ( contactId bigint not null, name varchar(255), user_id bigint not null, primary key (contactId) ) |