When using the @Id, @OneToOne and @PrimaryKeyJoinColumn annotations on a property, MetadataBuilder.build() throws a NullPointerException from the following code path:
I could reproduce this issue using both Hibernate ORM 5.1.3 and 5.2.6.
According to the Java EE docs, the @PrimaryKeyJoinColumn annotation may be used in a OneToOne mapping in which the primary key of the referencing entity is used as a foreign key to the referenced entity.
It seems like RootClass.identifier is null during the second pass (see above), when reached from the following code path:
A self-contained demo is available in
, it's runnable with mvn clean test. The @PrimaryKeyJoinColumn annotation is present on the Child.Parent field, the Hibernate bootstrapping process is attempted in Main.main(). The @OneToOne annotation is not bidirectional, it only goes from the Child to the Parent.