Given
{noformat}@Entity(name = "Client") public static class Client {
@Id @GeneratedValue private Long id;
private String name;
@Embedded private Log log = new Log();
.... }
@Entity(name = "User") @Table(name = "`User`") public static class User { @Id @GeneratedValue private Long id;
@Column(length = 120, nullable = false) private String name;
@ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "`idClient`") private Client client;
..... }
@Embeddable public static class Log { @Column(name = "`creationDate`", nullable = false) private OffsetDateTime creationDate;
... }{noformat}
the following code
{noformat}@Test public void load() { inTransaction( session -> { User user = session.find( User.class, userId ); } );
}{noformat}
causes
{noformat}javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value : Client.log.creationDate{noformat}
|
|