Java (JSP) code generation problem in a self many-to-many relationship

Hi

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() {
^

Advice, comments appreciated.

Best regards

Mikhail
Diagram.png

Interface.png

Hi Mikhail,

Thank you for your report. We are now investigating the problem. When there is any news, we’ll let you know.

Best regards,
Jick

Hi Mikhail,

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

Best regards,
Jick

Do you have the JSP Sample checked?

If so, could you post your Person_has_lendersProcessor.java.

Best regards

Mikhail

Note also that the SMART association should be selected.

The project is just this diagram. Nothing else to send.

Dear Mikhail,

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.

Can you send me yours?

Best regards,
Jick
person.vpp

Try adding an attribute to the person_has_lenders table in your ERD, e.g., a date, as shown in my original diagram.

The class diagram and the generated file set will be different then, isn’t it?

Hi Mikhail,

Thank you for correcting us. The problem has been fixed. Please download the patch release at:
http://files3.visual-paradigm.com/200710/Patch/sp1_20071003u/VP_Suite_Windows_3_1_sp1_20071003u.exe

Please run it, and overwrite the current installation.

Best regards,
Jick

Jick, could you also provide a patch for Mac OS. Thank you.

Mikhail

Hi Mikhail,

Yes, here you are:
http://files3.visual-paradigm.com/200710/Patch/sp1_20071003u/VP_Suite_MacOSX_3_1_sp1_20071003u.dmg

Best regards,
Jick

Jick

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()));

Hi Mikhail,

Sorry about this. I’ll check with our engineers and then come back to you as soon as possible.

Best regards,
Jick

Hi Mikhail,

The problem has been fixed. We will not allow generating JSP sample if DAO Interface is selected. You may download the patch at:
http://files3.visual-paradigm.com/200710/Patch/sp1_20071012j/VP_Suite_Windows_3_1_sp1_20071012j.exe

Best regards,
Jick

Any hint why you have selected to restrict this? Just to understand the problem better…

Could you also provide a patch for Mac OS. Thank you.

Mikhail

Hi Mikhail,

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.

http://files3.visual-paradigm.com/200710/Patch/sp1_20071101d/VP_Suite_Windows_3_1_sp1_20071101d.exe

and as I know DAO does not support generating JSP sample. It was a mistake for DAO Interface to be available. Therefore, we have disabled that option.

Best regards,
Jick

Could you post a link to a Mac OSX version. Thank you.

Yes, we are uploading. Sorry about this.

Hi Mikhail,

Please download again at:
http://files3.visual-paradigm.com/200710/Patch/sp1_20071101f/VP_Suite_MacOSX_3_1_sp1_20071101f.dmg

Best regards,
Jick

Ok. Thank you, Jick.