Java Reference
In-Depth Information
Creating your first Java EE 6
application with JBoss Forge
So Forge installation is quite easy; however, creating your first Java EE 6 application
will be even faster! Although we can create rather advanced applications with Forge,
for the purpose of learning we will just use a simple schema that contains a user
table, which can be built using the following command:
CREATE TABLE user (
id int(10) NOT NULL PRIMARY KEY auto_increment,
name varchar(50),
surname varchar(50),
email varchar(50));
The first thing we need to do is to create a new project using the new-project com-
mand. Execute from within the Forge shell the following commands:
new-project --named forge-demo --topLevelPackage
com.packtpub.as7development.appendix
-projectFolder forge-demo
Now you have a new Forge project, which is based on a Maven project structure.
Arguably, generating a new project isn't Forge's greatest value—the same could be
achieved with Maven archetypes. The sweet part of Forge is that now you have the
luxury of defining your own application skeleton interactively after it has already been
generated. This means that you can create the project using the Maven archetype
first, and then extend it using Forge's intuitive suggestions.
Since we will need to reverse engineer our database table into Java entities, we will
install the hibernate-tools plugin:
forge install-plugin hibernate-tools
The next step will be configuring the JPA layer for your application. This application
will be based on JBoss' JPA implementation that is based on the Hibernate provider,
Search WWH ::




Custom Search