Results 1 to 1 of 1

Thread: Modify mapping in DBRE.xml

Threaded View

  1. #1
    Join Date
    Jan 2012
    Posts
    11

    Default Modify mapping in DBRE.xml SOLVED

    Hi, I have used Roo for doing Reverse Engineering from my database.

    But I have a problem when i recover data from database for the , because 3 of my tables are associated among them and I think that It tries to recover data in a circular reference until it gives an error:

    28-feb-2012 10:08:12 com.springsource.insight.intercept.trace.SimpleFra meBuilder enter
    GRAVE: Frame stack exceeded MAX_FRAMES_PER_TRACE limit or has been aborted limit: 3000 frameCount: 3000 aborted: false
    28-feb-2012 10:08:12 com.springsource.insight.intercept.trace.SimpleFra meBuilder enter
    GRAVE: Frame stack exceeded MAX_FRAMES_PER_TRACE limit or has been aborted limit: 3000 frameCount: 1 aborted: true
    28-feb-2012 10:08:12 com.springsource.insight.intercept.trace.SimpleFra meBuilder enter
    GRAVE: Frame stack exceeded MAX_FRAMES_PER_TRACE limit or has been aborted limit: 3000 frameCount: 1 aborted: true
    28-feb-2012 10:08:12 com.vaadin.Application terminalError
    GRAVE: Terminal error:
    java.lang.IllegalStateException: Imbalanced frame stack! (exit() called too many times)

    So I want to change the mapping. I don't want that it recovers data from tables: usuariossacta and maquina when i recover data for grupo table.

    How can I change the mapping?

    When I have used Toplink, i could change the mapping with the Visual Editor, but how can i do it with dbre.xml?

    Can i change the Grupo class and quit the references to the other two tables? If I do it, will it fail because the dbre.xml still has the relationship definition?

    Thanks.

    The tables: https://picasaweb.google.com/lh/phot...t=d irectlink



    UPDATE: Ok, finally i have solved my problem.

    When you have a database model with circular references like this one:



    If you use Roo for generating your persistence with JPA, you obtain classes that have bi-directional references among them.

    When you generate your UI for Vaadin, you obtain a web application with a web page for each entity. But when you try to see your data, you can obtain this error:

    28-feb-2012 10:08:12 com.springsource.insight.intercept.trace.SimpleFra meBuilder enter
    GRAVE: Frame stack exceeded MAX_FRAMES_PER_TRACE limit or has been aborted limit: 3000 frameCount: 3000 aborted: false
    28-feb-2012 10:08:12 com.springsource.insight.intercept.trace.SimpleFra meBuilder enter
    GRAVE: Frame stack exceeded MAX_FRAMES_PER_TRACE limit or has been aborted limit: 3000 frameCount: 1 aborted: true
    28-feb-2012 10:08:12 com.springsource.insight.intercept.trace.SimpleFra meBuilder enter
    GRAVE: Frame stack exceeded MAX_FRAMES_PER_TRACE limit or has been aborted limit: 3000 frameCount: 1 aborted: true
    28-feb-2012 10:08:12 com.vaadin.Application terminalError
    GRAVE: Terminal error:
    java.lang.IllegalStateException: Imbalanced frame stack! (exit() called too many times)

    So... whats happening?

    If you go to your model package, you will see that Roo has generated a [name entity]_Roo_ToString.aj file, and inside there is a toString method.

    This method autogenerated is the responsible of your error because of these two lines in bold:

    public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("CanalIdCanal: ").append(getCanalIdCanal()).append(", ");
    sb.append("IdGrupo: ").append(getIdGrupo()).append(", ");
    sb.append("IdVersion: ").append(getIdVersion()).append(", ");
    sb.append("Ip: ").append(getIp()).append(", ");
    sb.append("Maquinas: ").append(getMaquinas() == null ? "null" : getMaquinas().size()).append(", ");
    sb.append("NombreGrupo: ").append(getNombreGrupo()).append(", ");
    sb.append("Puerto: ").append(getPuerto()).append(", ");
    sb.append("Usuariosactas: ").append(getUsuariosactas() == null ? "null" : getUsuariosactas().size());
    return sb.toString();
    }

    I don't now exactly why, but if you comment those lines in the 'toString' methods of the 3 classes the problem dissapears.
    Last edited by manuelcr; Mar 1st, 2012 at 03:20 AM. Reason: SOLVED

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •