A robust starter web application to ease Java webapp development.

Home | Tutorials | Demos | Issues

 « Return to Thread: Errors when genearate CRUD

Errors when genearate CRUD

by Kenny Ha :: Rate this Message:

Reply to Author | View in Thread

Hi all,

I create one table on MySQL.
CREATE TABLE `test` (
  `id` varchar(10) NOT NULL,
  `des` varchar(15) default NULL,
  PRIMARY KEY  (`id`)
)


 And running "mvn appfuse:gen-model" .That is build successful.
 And get one POJO object "Test.java" :

package com.mycompany.app.model;

import com.mycompany.app.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="test",catalog="maven_demo")
public class Test extends BaseObject implements Serializable {
    private String id;
    private String des;

    @Id  @GeneratedValue(strategy = GenerationType.AUTO)    
    public String getId() {
        return this.id;
    }
   
    public void setId(String id) {
        this.id = id;
    }
   
    @Column(name="des", length=15)
    public String getDes() {
        return this.des;
    }
   
    public void setDes(String des) {
        this.des = des;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Test pojo = (Test) o;

        if (des != null ? !des.equals(pojo.des) : pojo.des != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (des != null ? des.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("id").append("='").append(getId()).append("', ");
        sb.append("des").append("='").append(getDes()).append("'");
        sb.append("]");
     
        return sb.toString();
    }

}

but  I running "mvn -e appfuse:gen -Dentity=Test"  is error :

+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building AppFuse Struts 2 Application
[INFO]    task-segment: [appfuse:gen]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing appfuse:gen
[WARNING] POM for 'xfire:xfire-jsr181-api:pom:1.0-M1:compile' is invalid.

Its dependencies (if any) will NOT be available to the current build.
[INFO] [aspectj:compile {execution: default}]
[INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}]
[INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}]
[INFO] [resources:resources]
[WARNING] File encoding has not been set, using platform encoding MS932, i.e. bu
ild is platform dependent!
[WARNING] Using platform encoding (MS932 actually) to copy filtered resources, i
.e. build is platform dependent!
[INFO] Copying 47 resources
[INFO] Copying 2 resources
[INFO] Copying 125 resources
[INFO] Copying 125 resources
[INFO] [compiler:compile]
[INFO] Compiling 2 source files to E:\Green Sun\Projects\maven_demo\target\class
es
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
E:\Green Sun\Projects\maven_demo\src\main\java\com\mycompany\app\model\Person.ja
va:[24,84] 注釈が重複しています。


[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: Compilation failure
E:\Green Sun\Projects\maven_demo\src\main\java\com\mycompany\app\model\Person.ja
va:[24,84] 注釈が重複しています。


        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:699)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:540)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecy
cle(DefaultLifecycleExecutor.java:1168)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(Def
aultLifecycleExecutor.java:1009)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:627)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:553)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:523)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:371)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:332)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:181)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation fail
ure
E:\Green Sun\Projects\maven_demo\src\main\java\com\mycompany\app\model\Person.ja
va:[24,84] 注釈が重複しています。


        at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompiler
Mojo.java:516)
        at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:483)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:678)
        ... 20 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Wed Apr 15 14:51:07 ICT 2009
[INFO] Final Memory: 21M/254M
[INFO] ------------------------------------------------------------------------


Please tell me how to solve the problem
Thanks all!

 « Return to Thread: Errors when genearate CRUD