@Basic(optional) not overridden when using an @Embeddable type in Hibernate

Solution In Progress - Updated -

Issue

  • An entity using an embeddable attempts to override the @Basic(optional = false) setting

    @Embeddable
    public class MyEmbeddable ... {
        @Basic(optional = false)
        @Column(nullable = false)
        private String someProperty;
        ...
    }
    
    @Entity
    public class MyEntity ... {
        @Embedded
        @AttributeOverrides({
            @AttributeOverride(name = "someProperty", column = @Column(nullable = true)))
        })
        private MyEmbeddable embeddedType;
        ...
    }
    
  • The generated DDL marks the database column as non-null allowed
  • No warnings are logged and no exceptions are raised during configuration

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6
  • Hibernate 4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content