Announcement Announcement Module
Collapse
No announcement yet.
Spring Roo/DBRE + Some sort of error accessing a property Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Roo/DBRE + Some sort of error accessing a property

    Here is part of my stack trace:

    com.package.af.domain.DepreciationDetails.processA ccountingEntry_aroundBody6(DepreciationDetail.java :173)
    com.package.af.domain.DepreciationDetails.processA ccountingEntry(DepreciationDetail.java:1)
    com.package.af.web.FixedAssetController.processAcc ountingEntry(FixedAssetController.java:230)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)

    This is what I've done:

    1- Succesfully did a DBRE process on 4 tables
    2- For two of them Roo, found a primary key, the other two got a [Class]PK, composite key Class. This step its ok according with JPA specification.
    3- I can persist data on the tables that doesn't have the PK (composite primary key workaround)
    4- I've made a Push-In Refactor in those entities with the 'identifierType=[Class]PK.class', to modify them, that was ok.

    I cant set values to those properties, eventhough there's nothing wrong with them, if I see in the code at line 173 I see:

    DepreciationDetail.java:173

    Code:
    LegacyTableClass Header = new LegacyTableClass();
    Header.getId().setAnyStringField("any string value");  <---- This part here gives the error.
    As you can see, I think I am doing the things right, when I do

    Header.getId(), I am actually calling an instance of LegacyTableClassPK, with contains the properties, getters and setters, but it doesn't work.

    I don't know what to do, any clues?

  • #2
    Fortunely I've found it, I was wrong when I tried to set the properties of the composite PK Class. The correct way is:

    Code:
    LegacyTableClass instanceOfLegacyTableClass = new LegacyTableClass();
    LegacyTableClassPK legacyTableClassPk = new LegacyTableClassPK(fieldValue1, fieldValue2, fieldValue3);
    instanceOfLegacyTableClass.setId(legacyTableClassPk);
    instanceOfLegacyTableClass.persist();
    And that's all.

    Comment

    Working...
    X