Transient members with back-reference in combined Style

Hi,
I'm trying to create an entity with a transient reference (Many-to-One or One-to-One) to a non-persistent class. That class contains also a reference to the associated entity. the problem is that whatever I do I can't get it right. The best what I got was to give a stereotype "Reference" to the association and a stereotype "Transient" to association end of entity. However, if I try to update the uml representation of the class from classpath (or newly include the file in diagram), then the association is crippled, divided mostly in two different associations.

Is there any special way how to do this or do I have to update the code style?

Thanks in advance

Comments

  • Hi,

    In general, when updating an existing model from the code, UML Lab's Reverse Engineering tries to change the model as little as possible to reflect the existing code. So apparently it is not able to detect the existing association: A reason for this is often because the (JPA) code style doesn't support your code. In that case its necessary to create a proper code style.

    Could you please create a minimal source code example for me to reproduce the issue?

    Best regards
    Manuel
  • Hi,

    I have actually already resolved the issue by modifying the JPA1 code style where I'm checking the property and if it is instance of Transient then I generate only the Transient annotation instead of oneToMany/manyToOne/...

    seems to work properly.

    Best regards,
    Martin
  • Hi,

    That's nice to hear. Did you import the JPA Code Style project into your workspace to redefine the template?

    Please note, it's also possible to override one existing template file by including it in a workspace Code Style project. The template file must be contained in the same template package and have the same name like the existing template file. By only overriding one template you'll benefit from fixes/updates in future releases of UML Lab.

    Best regards,
    Manuel

    PS: Do you think your patch could be interesting for other users, too? So if you like, you can send it to me and then we'll include it in the next UML Lab release.
  • Hi,

    I have created new code style and there redefined the role rule (or whatever it is called). I have found the original JPA1 code style file in one of the UML Lab plugins so I took out the relevant part end modified just that one.

    Since I'm new to this you can at least verify if it is correct:) But as I said, it seems to work just all right.

    Best regards,
    Martin
    txt
    txt
    jpa1extension.txt
    3K
  • Hi,

    Great to see you successfully adapted the templates for your purpose. I'll see to it that we include your proposal into our templates.

    Best regards,
    Manuel
Sign In or Register to comment.