Hello,
Having the attached class diagram, I have the following issues when generating persistent code:
Question 1. I can’t have any kind of association relationship to PlanOS. I have the following error:
[Error] Plan OS: Class Composite element Plan OS cannot be referenced by classes other than ObraSocial.
Why? It’s not illegal.
Question 2. I have an Association Class ‘Afiliado’ between Paciente and PlanOS.
The navegability of this Association is from Paciente to PlanOS.
But in the generated code, PlanOS has navegability to Afiliado, and Afiliado has navegability to Paciente. Thus PlanOS has navegability to Paciente. It’s wrong.
//The following seems correct
import org.orm.*;
public class Paciente extends turnos.model.Persona {
public Paciente() {...}
public boolean deleteAndDissociate() {...}
...
private String profesion;
private String estadoCivil;
private turnos.model.Afiliado afiliado;
public void setProfesion(String value) {...}
...
public turnos.model.Plan_OS getPlan os() {...}
public void removePlan os() {...}
public void addPlan os(turnos.model.Afiliado aAfiliado, turnos.model.Plan_OS aPlan os) {...}
public void setAfiliado(turnos.model.Afiliado value) {...}
public turnos.model.Afiliado getAfiliado() {...}
}
//The following generated code seems correct
import org.orm.*;
public class Afiliado {
...
public boolean save() throws PersistentException {...}
public boolean delete() throws PersistentException {...}
public boolean refresh() throws PersistentException {...}
public boolean evict() throws PersistentException {...}
public boolean deleteAndDissociate()throws PersistentException {...}
public boolean deleteAndDissociate(org.orm.PersistentSession session)throws PersistentException {...}
private void this_setOwner(Object owner, int key) {...}
org.orm.util.ORMAdapter _ormAdapter = new org.orm.util.AbstractORMAdapter() {...}
private int ID;
private int NroAfiliado;
private turnos.model.Paciente paciente;
private turnos.model.Plan_OS plan_os;
//setters y getters
...
public void setPlan_os(turnos.model.Plan_OS value) {}
public turnos.model.Plan_OS getPlan_os() {}
/**
* This method is for internal use only.
*/
...
public void setPaciente(turnos.model.Paciente value) {...}
public turnos.model.Paciente getPaciente() {...}
...
}
//The following code seems not correct because of navegability
import org.orm.*;
public class Plan_OS {
...
public boolean save() throws PersistentException {...}
...
public boolean deleteAndDissociate()throws PersistentException {...}
private java.util.Set this_getSet (int key) {...}
org.orm.util.ORMAdapter _ormAdapter = new org.orm.util.AbstractORMAdapter() {...};
private int ID;
private Integer Nombre;
private Integer Categoria;
private Integer Estado;
private java.util.Set ORM_afiliados = new java.util.HashSet(); //I think it's not correct because of the navegability
//setters and getters
...
private void setORM_Afiliados(java.util.Set value) {//I think it's not correct because of the navegability
this.ORM_afiliados = value;
}
private java.util.Set getORM_Afiliados() {//I think it's not correct because of the navegability
return ORM_afiliados;
}
public final turnos.model.AfiliadoSetCollection afiliados = new turnos.model.AfiliadoSetCollection(this, _ormAdapter, turnos.model.ORMConstants.KEY_PLAN_OS_AFILIADOS, turnos.model.ORMConstants.KEY_AFILIADO_PLAN_OS, turnos.model.ORMConstants.KEY_MUL_ONE_TO_MANY);//I think it's not correct because of the navegability
...
}
Is the generated code wrong? Or am I wrong?
Thanks in advance.
Best regards.
clasesturnos.jpg