To generate all the JSF CRUD artifacts for a new entity with AppFuse Maven
plugin you need to:
1. create a POJO data entity in your project's model folder (e.g.
$PROJECT_ROOT/src/main/java/com/myproject/model)
2. add annotations to your entity. For example:
package com.myproject.model;
@Entity
public class Customer extends BaseObject {
private Long id;
private Integer version;
private String name;
/**
* Default constructor - creates a new instance with no values set.
*/
public Customer() {}
@Id @GeneratedValue(strategy=GenerationType.AUTO)
public String getId() {
return id;
}
@Version
public Integer getVersion() {
return version;
}
@Column(nullable=false,length=20)
public String getName() {
return name;
}
public void setId(Long id) {
this.id = id;
}
public void setVersion(Integer version) {
this.version = version;
}
public void setName(String name) {
this.name = name;
}
// @TODO HERE YOU MUST IMPLEMENT equals, hashCode and toString
}
3. open a command prompt, go to your PROJECT ROOT and run this command (the
2 last parameters are optional):
mvn appfuse:gen -Dentity=Customer -Damp.genericCore=false
-Damp.fullSource=true
4. fix generated code
4.1. open sample-data.xml and trim values for version. AppFuse adds some
spaces which you must remove before you can build your project.
4.2. open files main/resources/hibernate.cfg.xml and
test/resources/hibernate.cfg.xml. Copy the new entry for your Customer
entity from the 1st to the 2nd one or test cases will fail during build.
5. start AppFuse and test your new menu entry and screens.
mvn clean jetty:run-war
Hope that helps,
Pedro Burglin
abbey477 wrote:
>
> Hello,
>
> Having gone through the AppFuse QuickStart guide, I need more information
> on to generate JSF CRUD artifacts using AppFuse. As this will be a great
> justification for using the framework for my organization.
>
> Thanks.
>
--
View this message in context:
http://www.nabble.com/Generating-JSF-crud-Artifacts-tp18297644s2369p18322516.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]