Visual Paradigm Logo
     Build Quality Applications Faster, Better and Cheaper
 
Home | Products | Download | Documentation | Support | Resources | Partners | Quick Tour | Shop | Company |  
 
   Visual Paradigm Discussion Forum
  Login   [ Register ] Email: Password: Log me on automatically I lost my password  
Recent Topics
Advanced Search
Java (JSP) code generation problem in a self many-to-many relationship  
Forum Index -> DB Visual ARCHITECT (DB-VA)
Go to Page: 1 2 Next
Author Message
Mikhail


Joined: 2007/08/30
Messages: 12

Offline

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

Attached Image : No description given (12 kb)

Attached Image : No description given (75 kb)

 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

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

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

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

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
Mikhail


Joined: 2007/08/30
Messages: 12

Offline

Do you have the JSP Sample checked?

If so, could you post your Person_has_lendersProcessor.java.

Best regards

Mikhail
 
Mikhail


Joined: 2007/08/30
Messages: 12

Offline

Note also that the SMART association should be selected.
 
Mikhail


Joined: 2007/08/30
Messages: 12

Offline

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


Joined: 2005/04/29
Messages: 2880

Offline

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
 Description Download
 Filesize 28 kb
 Downloaded:  87 time(s)


Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
Mikhail


Joined: 2007/08/30
Messages: 12

Offline

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?
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

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

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
Mikhail


Joined: 2007/08/30
Messages: 12

Offline

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

Mikhail
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

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

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
Mikhail


Joined: 2007/08/30
Messages: 12

Offline

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


Joined: 2005/04/29
Messages: 2880

Offline

Hi Mikhail,

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

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
Jick


Joined: 2005/04/29
Messages: 2880

Offline

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

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
Mikhail


Joined: 2007/08/30
Messages: 12

Offline

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
 
 
   Forum Index -> DB Visual ARCHITECT (DB-VA)
Go to Page: 1 2 Next
Go to:   
Powered by JForum 2.1.4 © 2005 - Rafael Steil