Hibernate Save Parent Only
- by user239905
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();