You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class PublicationBasicDataForm {
public PublicationType publicationType;
@ContainsSupportedLanguages
@Valid
@BeanCollection(elementType = PublicationTitle.class, beanCollectionUsage = BeanCollectionUsage.CLEAR)
public Set<TextForm> titles;
}
Because we have OrphanRemoval on and we update the existing hash set, we can replace the contents in the database without getting duplicates. This does mean however that we have to create a setter for the id field in BaseEntity, because BeanMapper needs to set that in order for Hibernate to know that we intend to edit an existing entity. We would prefer not to do this, as this allows anyone to set the id of an entity, which we want Hibernate to handle itself.
Rob and I discussed this and we see two possible solutions:
Allow a marker annotation on a field in the form object to indicate that we want to allow a private field to be accessed and set via reflection.
Created a 'nested merged form', Beanmapper would fetch the appropriate PublicationTitles from the database and apply the changes to the appropriate PublicationTitle based on the id in the form object.
It would be nice to investigate what solution would fit the Beanmapper architecture and philosophy best.
The text was updated successfully, but these errors were encountered:
The situation is as follows:
We have an entity called Publication that contains a collection of PublicationTitle entities (which are implementations of Text entities):
In our request when updating the Publication, we sent all the (possibly modified) instances of PublicationTitle that belong to the given publication:
That maps to the following form object:
Because we have OrphanRemoval on and we update the existing hash set, we can replace the contents in the database without getting duplicates. This does mean however that we have to create a setter for the id field in BaseEntity, because BeanMapper needs to set that in order for Hibernate to know that we intend to edit an existing entity. We would prefer not to do this, as this allows anyone to set the id of an entity, which we want Hibernate to handle itself.
Rob and I discussed this and we see two possible solutions:
Allow a marker annotation on a field in the form object to indicate that we want to allow a private field to be accessed and set via reflection.
Created a 'nested merged form', Beanmapper would fetch the appropriate PublicationTitles from the database and apply the changes to the appropriate PublicationTitle based on the id in the form object.
It would be nice to investigate what solution would fit the Beanmapper architecture and philosophy best.
The text was updated successfully, but these errors were encountered: