Mapping database one-to-many relations in java object is often unnecessary and not wished since they can be retrieved via explicit calls, and reduce entity code.
No need to map 10 possible one-to-many relations if only 2-3 should always be fetched.
This works fine aslong no cascading operations are necessary on those relations which enforce the mapping of one-to-many into java set's or others.
Proposal: Allow declaring cascading effects without the need of a mapped property.
<set name="childs" inverse="true" cascade="delete" lazy="true" > <key column="id" not-null="true" on-delete="cascade"/> <one-to-many class="de.store24.logic.db.entities.TestChild"/> </set>
I don't want to map the property, just define the cascade effect so that either hibernate is responsible of cascading or the second-level cache is aware of the database cascade.
|