KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
HiAll, i try currently to understand, what is wrong in my coding and entity model I use the hibernate 4.2 to for CRUD operation with just Generic DAO pattern and annotated entities with cascading ALL and orphanRemoval= true. I have the DayPlan entity with OneToMany relationship to DayPlanElement weak entity. The DayPlanElement are saved into java.util.Set. Each DayPlanElement has a property "order". The DayPlan has also OneToMany relationship to an entity Person . The entity Person saved into java.util. List . The DayPlanElement has OneToMany relationship to DayPlanElementEntry weak entity. java.util.Set used for save. The Person entity also OneToMany relationship to DayPlanElementEntry weak entity. java.util.Set used for save. The DayPlan , DayPlanElement and Person entities have the ID, managed by my application, as String. The DayPlanElementEntry weak entity has a composite Id: DayPlanElementEntryId annotated with EmbeddedId, contains the parentPersonId and dayPlanElementId. It In other words imagine, that exists a table, represents the day plan. The columns are the hours from 0 up to 24. The rows are the persons, that must proceed the operations from day plan. Each column would be DayPlanElement entity. Each row would be Person entity. And each cell would be DayPlanElementEntry entity. If i just add to table new elements (also Persons) and remove its (also remove its from List and then call the DayPlanDAO.merge(dayPlan) - i hope on cascading and orphanRemoval) - i have no problem. Only if i try to reorder the given Persons (just removing operations within java.util.List) and the call DayPlanDAO.merge(dayPlan) - the following excepion will be thrown: Caused by: java.lang.IllegalStateException: Error occurred while storing entity [DayPlanEleme
Tags (comma-separated)
Save Edits
Cancel