Reputation: 16982
I have a java object [representing db tables] which in turn contains multiple other java objects.
I would like to not to persist one object in the main object hierarchy when the main object is being persisted. Is it possible to do it via Hibernate? I would not want to change the entity object , since this object which I don't want to persist in this specific case needs to be persisted for other operations.
Upvotes: 0
Views: 54
Reputation: 11805
sure, set the "cascade" attribute on your field mapping to an empty array
@OneToMany(cascade = { })
Note that this is the default.
It would be helpful if you would post some of your code, so it's easier to answer based on how your mapping is set up.
Upvotes: 2