Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

undefined property field-name #11

Closed
outis10 opened this issue Jun 23, 2015 · 10 comments
Closed

undefined property field-name #11

outis10 opened this issue Jun 23, 2015 · 10 comments

Comments

@outis10
Copy link

outis10 commented Jun 23, 2015

Hi, again i have and issue in a simple example model
this is my model

image

and I get this error
Parser detected: MODELIO.

Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
at EntitiesCreator.getAssociationFieldName (C:\Users\narciso.parra\AppData\Roaming\npm\node_modules\jhipster-uml\lib\entitiescreator.js:276:66)
at EntitiesCreator.setRelationshipOfEntity (C:\Users\narciso.parra\AppData\Roaming\npm\node_modules\jhipster-uml\lib\entitiescreator.js:206:32)
at EntitiesCreator.createEntities (C:\Users\narciso.parra\AppData\Roaming\npm\node_modules\jhipster-uml\lib\entitiescreator.js:52:12)
at Object. (C:\Users\narciso.parra\AppData\Roaming\npm\node_modules\jhipster-uml\jhipster-uml.js:73:11)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)

Thanks In advance!!!

@MathieuAA
Copy link
Member

Hi!

From your pic, I don't see why this fails. Author is clearly mentionned...
Can you send me your XMI file please? I'd like to run some tests (I'll try to reproduce what you tried to do in order to better understand this issue).

Also, this may be related: you have a bidirectional relationship. It will throw a CircularDependency later when figuring out which class is to be generated first.

@outis10
Copy link
Author

outis10 commented Jun 23, 2015

Here is the xmi file

On Tue, Jun 23, 2015 at 12:24 PM, Mathieu ABOU-AICHI <
notifications@github.com> wrote:

Hi!

From your pic, I don't see why this fails. Author is clearly mentionned...
Can you send me your XMI file please? I'd like to run some tests (I'll try
to reproduce what you tried to do in order to better understand this issue).

Also, this may be related: you have a bidirectional relationship. It
will throw a CircularDependency later when figuring out which class is to
be generated first.


Reply to this email directly or view it on GitHub
#11 (comment)
.

@outis10
Copy link
Author

outis10 commented Jun 23, 2015

Ok It seems to I can´t send xmi file with attachment so I paste de file
here:

http://www.omg.org/spec/UML/20110701" xmlns:xmi="
http://schema.omg.org/spec/XMI/2.1" xmi:version="2.1"
xmi:id="_0EfOwBnaEeWw3ro4S7dYeg" name="poc">
































/uml:Model

On Tue, Jun 23, 2015 at 12:31 PM, Mathieu ABOU-AICHI <
notifications@github.com> wrote:

Don't forget the file =)


Reply to this email directly or view it on GitHub
#11 (comment)
.

@MathieuAA
Copy link
Member

I can't import it because Modelio tells me it's not a valid XMI file... I'll do the same diagram to test it.

@outis10
Copy link
Author

outis10 commented Jun 23, 2015

This I the one y probe in another modelio project:

http://www.omg.org/spec/UML/20110701" xmlns:xmi="
http://schema.omg.org/spec/XMI/2.1" xmi:version="2.1"
xmi:id="_DyhREBnfEeWw3ro4S7dYeg" name="poc">
































/uml:Model

On Tue, Jun 23, 2015 at 12:38 PM, Mathieu ABOU-AICHI <
notifications@github.com> wrote:

I can't import it because Modelio tells me it's not a valid XMI file...
I'll do the same diagram to test it.


Reply to this email directly or view it on GitHub
#11 (comment)
.

@MathieuAA
Copy link
Member

The issue is caused by the bidirectional relationship (they're evil).

I don't exactly see why they cause this to fail, but it works with this version of your file:

issue11

We should not close this thread yet, I want to find out why this breaks in the EntityCreator.

@MathieuAA
Copy link
Member

Ok I got it (easy as pie)!

Modelio, if there's a bidirectional relationship, doesn't set a "name" attribute to its association tag:

<packagedElement xmi:type="uml:Association" xmi:id="_0EfOyxnaEeWw3ro4S7dYeg" memberEnd="_0EfOxRnaEeWw3ro4S7dYeg _0EfOzRnaEeWw3ro4S7dYeg"/>

The error is due to the fact that we partly check if there's no error! An injected field should have been deduced when reading the extracted data, but as there was nothing to read, an exception was thrown.

I'm going to fix this ASAP.

Please let me know if using a unidirectional association works for you (I'll close this thread after the fix is pushed).

MathieuAA pushed a commit that referenced this issue Jun 23, 2015
Bidirectional relationships now recognized as such, and now throw an exception.
@MathieuAA
Copy link
Member

I'm closing this as the bug is now noticed.
Feel free to re-open this thread if I did something wrong.

@outis10
Copy link
Author

outis10 commented Jun 23, 2015

This is proof of concept I am playing with jhipster-uml because I will
start a project(at leas 25 tables) of collecting account and I had mapped
bidirectional relationships
but I can leave without these relationships.

So Thanks and I will around here.

On Tue, Jun 23, 2015 at 12:54 PM, Mathieu ABOU-AICHI <
notifications@github.com> wrote:

Ok I got it (easy as pie)!

Modelio, if there's a bidirectional relationship, doesn't set a "name"
attribute to its association tag:

The error is due to the fact that we don't check if this attribute exists!
If it does, then everyting's alright. If it doesn't then something's
clearly wrong.

I'm going to fix this ASAP.

Please let me know if using a unidirectional association works for you
(I'll close this thread after the fix is pushed).


Reply to this email directly or view it on GitHub
#11 (comment)
.

@MathieuAA
Copy link
Member

JHipster manages bidirectional relationships just fine!

UML-y speaking, bidirectional aren't that good, that's why we decided not to allow them at all (they can cause lots of issues, and usually can be replaced by better designs).

You can just "convert" your bidirectional to unidrectional, and it everything should work great.
Don't hesitate to open a new thread if you have any question regarding your POC, we'll be happy to help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants