You can't use DefaultComponentSafeNamingStrategy with Hibernate 5, because of it is an implementation of the old NamingStrategy interface from Hibernate 4.
As you probably know, Hibernate 5 uses two new interfaces ImplicitNamingStrategy and PhysicalNamingStrategy.
You can use this implicit naming strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyComponentPathImpl.
You will need to set hibernate.implicit_naming_strategy property (not hibernate.ejb.naming_strategy).
For these entities
@Embeddable
public class AuthorInfo {
@Column
private String authorInfo;
@OneToOne
private Book bestBook;
}
@Entity
public class Book {
@Id
private Long pid;
@Embedded
private AuthorInfo firstAuthor;
@Embedded
private AuthorInfo secondAuthor;
}
it creates this schema
create table Book (
pid bigint not null,
firstAuthor_authorInfo varchar(255),
secondAuthor_authorInfo varchar(255),
firstAuthor_bestBook_pid bigint,
secondAuthor_bestBook_pid bigint,
primary key (pid)
)
Unit test to check a schema: TwoEmbeddedStrategyTest.java