Creating the project

The project creation is very similar to the one that we used for the example in Chapter 3, the only difference is that now we are going to connect our project to the MySQL DBMS. Therefore, we have to configure it in a proper way.

Open a terminal window and move into the JBoss Seam distribution directory, execute the following command from here, for Microsoft Windows and Unix/Linux/Mac OS X:

Microsoft Windows

Unix/Linux/Mac OS X

seam setup

./seam setup

After the welcome text, let's enter our new project configuration data (seam-gen will keep the old data, so you don't have to rewrite all the configuration information):

  • Enter your Java project workspace (the directory that contains your Seam projects): This is the directory where we want to save our new project (it depends on our environment and preferences), it might be same as that of our example project.
  • Enter your JBoss AS home directory: It is the directory where JBoss AS is installed.
  • Enter the project name: Let's enter AdvContactManager.
  • Do you want to use ICEfaces instead of RichFaces [n]: No. We want to use RichFaces, so just press Enter.
  • Select a RichFaces skin [classic] (blueSky, [classic], deepMarine, DEFAULT, emeraldTown, japanCherry, ruby, wine): We can change it later, for now classic skin is okay, so just press Enter.
  • Is this project deployed as an EAR (with EJB components) or a WAR (with no EJB support) [ear]: We would like a complete EAR application with EJB support, so just press Enter.
  • Enter the Java package name for your session beans: Let's enter book.richfaces.advcm.
  • Enter the Java package name for your entity beans: Again, let's enter book.richfaces.advcm.
  • Enter the Java package name for your test cases: Let's enter book.richfaces.advcm.test.
  • What kind of database are you using?: This time we want to use MySQL DBMS, so let's enter mysql.
  • Enter the Hibernate dialect for your database: Let's enter org.hibernate.dialect.MySQLDialect.
  • Enter the filesystem path to the JDBC driver jar: It must be a path to the MySQL JDBC driver JAR file (if you don't have it, download it from http://dev.mysql.com/downloads/connector/j/ (the actual version is 5.1.7)).
  • Enter JDBC driver class for your database: Let's enter com.mysql.jdbc.Driver.
  • Enter the JDBC URL for your database: If your MySQL DBMS is installed in your computer (localhost), enter jdbc:mysql://localhost/advcm_db. If not, specify a proper host instead of localhost.
  • Enter database username: Insert the username to access the database.
  • Enter database password: Insert the password to access the database.
  • Enter the database schema name (it is OK to leave this blank): Leave it blank and press Enter.
  • Enter the database catalog name (it is OK to leave this blank): Leave it blank and press Enter.
  • Are you working with tables that already exist in the database?: Enter y.
  • Do you want to drop and recreate the database tables and data in import.sql each time you deploy?: No, press Enter.

Okay, we've done the configuration, and we will see how to configure it for a MySQL DBMS connection in the next chapter (when we will start making the real application). For now it's okay to use the default answers.

We are ready to create the project using the following commands for Microsoft Windows and Unix/Linux/Mac OS X:

Microsoft Windows

Unix/Linux/Mac OS X

seam create-project

./seam create-project

Now let's create the JPA entities (our application data model) automatically using the following commands for Microsoft Windows and Unix/Linux/Mac OS X:

Microsoft Windows

Unix/Linux/Mac OS X

seam generate-model

./seam generate-model

If you are using the Eclipse IDE, you have to import the project into the workspace (we described how to do that in Chapter 2, Getting Started). With other IDEs (IntelliJ or NetBeans), you can just open it from the location in which you've told seam-gen to create it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.71.106