Cascading the one-to-one persist operation

The CascadeType.PERSIST comes along with the CascadeType.ALL configuration, so we only have to persist the Info entity, and the associated InfoDetails entity is persisted as well:

Info info = new Info();
info.setName("Wildfly Book Info");
InfoDetails details = new InfoDetails();
info.addDetails(details);
...
entityManager.persist(info);
...

Generating the following output:

INSERT INTO info(id, NAME)
VALUES (DEFAULT,'Wildfly Book Info')
insert into InfoDetails (id, created_on, visible)
values (1, '2016-01-03 16:17:19.14', false)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.151.158