Hibernate Save Parent Only
Posted
by user239905
on Stack Overflow
See other posts from Stack Overflow
or by user239905
Published on 2010-06-15T20:55:51Z
Indexed on
2010/06/15
21:22 UTC
Read the original article
Hit count: 170
hibernate
Hi, I'm having an issue with Hibernate 3.2.5, where I have to save only the parent object in a one-to-many relationship.
For example, I have a flower A, that can have many details. Firstly I want to save only the flower, and the details will be added later.
This process throws an exception:
not-null property references a null or transient value: com.juflora.bean.JFlora._floraSetBackref
This is my code:
JFlora flora = new JFlora();
flora.setTypeId(Integer.parseInt(type));
flora.setDescription(description);
flora.setName(name);
flora.setImage(image);
flora.setFloraDetails(new HashSet());
session.save(flora);
session.getTransaction().commit();
© Stack Overflow or respective owner