proTeam wrote:
Tiggy,
thank you for your answer.
I´d prefer to do it with hql, but as I mentioned I´ve got some trouble with deleting the CollectionOfElements. Do you know a solution to that?
The problem is, that the collection is not mapped (because it is not an entity) and therefor can´t be addressed through hql like an entity, but is not cascaded as well.
The problem using pure sql is, that I still have the constraints in the table, which I would like to use in the live-system. I don´t know of any way to disable the constraints using jdbc, is there? Otherwise I cannot use the metadatam, but have to maintain a defined sequence of deletion myself.
Any input on this would be greatly appreciated.
Thomas
You cannot use delete for the collectionOfElements because it has no identifier. It has no sense. In fact an embedded has the same life cycle of its parent. It means that there is implicit cascadeType.DELETE. In other words it is deleted automatically when its parent is deleted.
For the constraints it depends of your database.
With oracle you can easily disable constraints with sql statement, I do not know for others.... but I think it should be possible for most databases.
Tiggy