First object is named Persona.
Second object is named Societa. There is a relation many for Persona and one for Societa.
Societa has two properties, let's call them "des" and "desIndirizzo".
I've a spring form (<form:form>) with modelattribute="person" in order to change some person properties submitting such form.
Here an example:
From this form I need to change not only Persona's properties but also Societa's properties.
I think to write
This doesn't work.
I get "TransientObjectException: object is an unsaved transient instance - save the transient instance before merging: net.coop.domain.Societa"
Anyway, in the browser I can see both the input texts correctly filled with the right values!
My questions are:
First: Because I set modelattribute="persona", I was expecting that "societa.des" is the same as "persona.societa.des". After a debug I see that "societa.des" is the same as "persona.des". Obviously this doesn't exists! Why? The only manner to work is to write
But in this case a new question arises:
Second: How can I relate the first <form:input> in order to submit the Societa's "des" property and the second <form:submit> to the Societa's "desIndirizzo" property?
Third: More in general, is it possible to change properties of a object (in my case Societa) from a form of a related object (Persona)?
I also wrote and registered a property editor like this: