I'm using EclipseLink,
WildFly,
EJB, postgresSQL and
JSF.
I'm trying to persist some countries and their localities.
So I've:
- Two entities Countries and Localities in which I specify respective columns and relations.
- Abstract Session beans for entity classes: AbstractFacade providing basic crud methods and entity manager.
- Two concrete session bean for entity classes: CountriesFacade and LocalitiesFacade.
- A JSF managed bean named geoJSF.
- A JSF page with a form allowing to insert new country and localities.
In geoJSF I'm injecting via EJB CountriesFacade as property named cf and LocalitiesFacade as property named lf.
For the actual inserting country and locality I'm using geoJSF.country and geoJSF.locality.
When the form is submitted I'm simply doing:
I disabled all cascade among relations definitions.
Based on what I know this.country should appear detached to entity manager so, setting relation the entity manager try to re-persist it.
But I don't know how to resolve.