emmanuel wrote:
did you try? Does it work?
Yes, I tried before posting. The result is
Code:
org.hibernate.MappingException: only inverse one-to-many associations may use on-delete="cascade": my.org.Raconteur.witticisms
at org.hibernate.mapping.Collection.validate(Collection.java:265)
at org.hibernate.mapping.Set.validate(Set.java:19)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1106)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
at my.org.MyHibernateUtil.<clinit>(MyHibernateUtil.java:39)
... 23 more
The point of my question was to determine whether there's any way to get Hibernate to emit ON DELETE CASCADE for a @CollectionOfElements, just as it will do so for an inverse association.
If it is impossible to do so, then I will create an entity to contain the String, and associate them. I would consider it a kluge to have to do so, hence my question. The question was asked in good faith.