While generating Java code for a self many-to-many relationship depicted in the attached diagram with parameters shown in the attached screen copy the DBVA code generator fails to distinguish between the two instances of PERSON in the Person_has_lendersProcessor.java.
The two generated instances appear with the same name as shown below:
import org.orm.PersistentException;
/**
ORM-Persistable Class
*/
public class Person_has_lendersProcessor {
...
private int personid;
public void setPersonid(int value) {
this.personid = value;
}
public int getPersonid() {
return personid;
}
private int personid;
public void setPersonid(int value) {
this.personid = value;
}
public int getPersonid() {
return personid;
....
This leads to the following compilation errors:
src/Person_has_lendersProcessor.java:49: personid is already defined in Person_has_lendersProcessor
private int personid;
^
src/Person_has_lendersProcessor.java:51: setPersonid(int) is already defined in Person_has_lendersProcessor
public void setPersonid(int value) {
src/Person_has_lendersProcessor.java:55: getPersonid() is already defined in Person_has_lendersProcessor
public int getPersonid() {
^
We were unable to reproduce your problem. Could you send me your project? I suggest you not to post here. You may send to my Email address: jick@visual-paradigm.com
If sync the ERD to Class Diagram, it should be only 1 class Person with 1 self many-to-many association, which result in generating one jsp file (PersonProcessor) only, and should not generate Person_has_lendersProcessor.java. Our project is attached.
Thank you for this fix. There is more to this, however.
Have you tried to compile the project after this issue was fixed?
Personally, I could not compile it with 22 errors returned. All errors are related to one point: Methods are defined in the DAO objects of the Person and Person_has_lenders objects while the generated code assumes they are declared in the objects themselves.
For example, loadPersonByORMID is declared and implemented in PersonDAO and PersonDAOImpl correspondingly while the generated code attempts to call it via Person (see below).
Since this is just generated code, not a single line was added, I assume the generation procedure needs some more attention.
Could you look into it and advice? Thank you.
Best regards
Mikhail
src/person/PersonProcessor.java:73: cannot find symbol
symbol : method loadPersonByORMID(int)
location: class person.Person
person.Person _person =person.Person.loadPersonByORMID(getId());
src/person/PersonProcessor.java:88: cannot find symbol
symbol : method createPerson()
location: class person.Person
person.Person _person = person.Person.createPerson();
src/person/PersonProcessor.java:90: cannot find symbol
symbol : method save()
location: class person.Person
if (_person.save()) {
^
src/person/PersonProcessor.java:103: cannot find symbol
symbol : method loadPersonByORMID(int)
location: class person.Person
person.Person _person= person.Person.loadPersonByORMID(getId());
…
src/person/Person_has_lendersProcessor.java:80: cannot find symbol
symbol : method createPerson_has_lenders()
location: class person.Person_has_lenders
person.Person_has_lenders _person_has_lenders = person.Person_has_lenders.createPerson_has_lenders();
^
src/person/Person_has_lendersProcessor.java:82: cannot find symbol
symbol : method save()
location: class person.Person_has_lenders
if (_person_has_lenders.save()) {
^
src/person/Person_has_lendersProcessor.java:95: cannot find symbol
symbol : method loadPersonByORMID(int)
location: class person.Person
person.Person_has_lenders _person_has_lenders= person.Person_has_lenders.loadPerson_has_lendersByORMID(person.Person.loadPersonByORMID(getBorrower_personid()), person.Person.loadPersonByORMID(getLender_personid()));
I would like to let you know we have released a newer build recently and it is recommend for you to upgrade to this build. Please download and install the new build at the following link. If you need any help, please do not hesitate to contact me.