Frage

I have a Spring Roo (1.2.2) project that I'm trying to build. From a clean SCM checkout, a mvn clean install builds nicely.

However, when I import the project into my SpringSource Tool Suite IDE (packaged with m2eclipse and Roo 1.2.4), then Eclipse invokes roo to update the POM's <roo.version>, which then updates the entity aspects. After this, all of the methods with java.util.Date paremeters/return types no longer work, as compilation produces symbol not found errors on the Date fields.

How do I get Roo to generate aspects with a type of Date instead of Calendar?

Error Log

[ERROR] /Users/jjzabkar/project/src/main/java/com/so/FooBar.java:209:0::0 The method setTokenExpires(Calendar) in the type FooBar is not applicable for the arguments (Date)  
[ERROR] error at account.setLastaccessTime(Calendar.getInstance().getTime());

Research

Old POM

<roo.version>1.2.2.RELEASE</roo.version>

Updated POM

<roo.version>1.2.4.RELEASE</roo.version>

FooBar.java Entity

@RooJavaBean
@RooToString
@RooJpaActiveRecord(versionField = "", table = "foo_bar")
@RooDbManaged(automaticallyDelete = true)
public class FooBar {
}

Aspect BEFORE for Roo Version 1.2.2

privileged aspect FooBar_Roo_DbManaged {
    ...
    @Column(name = "lastaccess_time")
    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date FooBar.lastaccessTime;

    public Date FooBar.getLastaccessTime() {
        return lastaccessTime;
    }

    public void FooBar.setLastaccessTime(Date lastaccessTime) {
        this.lastaccessTime = lastaccessTime;
    }

}

Aspect AFTER for Roo Version 1.2.4

privileged aspect FooBar_Roo_DbManaged {
    ...
    @Column(name = "lastaccess_time")
    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "MM")
    private Calendar FooBar.lastaccessTime;

    public Calendar FooBar.getLastaccessTime() {
        return lastaccessTime;
    }

    public void FooBar.setLastaccessTime(Calendar lastaccessTime) {
        this.lastaccessTime = lastaccessTime;
    }

}
War es hilfreich?

Lösung

Before update to Roo 1.2.4 you should push-in Date fields to .java, by doing that Roo won't generate them again and won't change the type to Calendar.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top