Presentation is loading. Please wait.

Presentation is loading. Please wait.

WaveMaker Visual AJAX Studio 4.0 Training

Similar presentations


Presentation on theme: "WaveMaker Visual AJAX Studio 4.0 Training"— Presentation transcript:

1 WaveMaker Visual AJAX Studio 4.0 Training
Basics: Building Your First Application Database Basics

2 Building your First Application
Define Data 2. Build GUI 3. Bind data to GUI Import data in Live Tables Drag-n-drop widgets in Page Designer Connect data to widgets in Page Designer Can deploy app to any Java server Can also import Java and Web Services ** Steps 1 and 2 can be reversed – you can design first then add data

3 Define Data Database Terminology To access a database in your application, you must import the database schema. Data Model : the representation of a database imported into your WaveMaker project. LiveTable: the representation of a table in your data model Columns: the representation of the columns in your database Relationships: the representation of the foreign key relationships from your database

4 Define Data Supported Databases All databases that are supported by Hibernate are supported in WaveMaker Built-in Support: PostGreSQL MySQL Oracle DB2 SQL Server Hypersonic SQL DB (HSQLDB)

5 How to Import a Database
Define Data How to Import a Database On the Create & Import menu -> Select Database Import… Opens the Import Database editor Enter settings Click Test Connection If successful, click Import Save the project

6 Connection Parameters
Define Data Connection Parameters Some fields are dependent on type of database imported Service Name – name of the data model in WaveMaker, can be same as database name, alphanumeric characters only Username – login name for database Password – corresponding password for username Database System – select type of database Host – network host for database, default is localhost Port – port number to connect to database Database – name of database to import File – location of HSQLBD database on file system SID – Oracle System Identifier, instance of Oracle running on the server Instance – name of SQL server instance Be sure to give your new data model a good human readable name (In the Service Name field) Different databases require different connection settings DB2 When you import a DB2 database, you will need to type the following settings into the “Database Connection” screen: Database System: The type of database you want to import. Choose DB2. Host: The network host for the DB2database. Default value is localhost. Port: The port number for the DB2 database. Database: The name of the database. HSQLDB When you import an HSQLDB database, you will need to type the following settings into the “Database Connection” screen: Database System: The type of database you want to import. Choose HSQLDB. File: The location of the HSQLDB database on your file system. For example, if your database file is called cmdb and it is in C:\Program Files\WaveMaker, then you would type in: C:\Program Files\WaveMaker\Support\Data\cmdb\cmdb MySQL When you import a MySQL database, you will need to type the following settings into the “Database Connection” screen: Database System: The type of database you want to import. Choose MySQL. Host: The network host for the MySQL database. Default value is localhost. Port: The port number for the MySQL database. Database: The name of the database instance. Oracle When you import an Oracle database, you will need to type the following settings into the “Database Connection” screen: Database System: The type of database you want to import. Choose Oracle. Host: The network host for the Oracle database. Default value is localhost. Port: The port number for the Oracle database. SID: The Oracle System Identifier that refers to the instance of the Oracle database running on the server. The default is ORCL, which is the default SID that is configured when installing your Oracle database. PostgreSQL When you import a PostgreSQL database, you will need to type the following settings into the “Database Connection” screen: Database System: The type of database you want to import. Choose PostgreSQL. Host: The network host for the PostgreSQL database. Default value is localhost. Port: The port number for the PostgreSQL database. SQL Server When you import a SQL Server database, you will need to type the following settings into the “Database Connection” screen: Database System: The type of database you want to import. Choose SQLServer. Host: The network host for the SQL Server database. Default value is localhost. Port: The port number for the SQL Server database. Instance: The name of the SQL Server instance.

7 Define Data Advanced Options Used when connection to large databases or connecting to an non-support database Connection URL – JDBC connection URL Java Package – Change the default package name for auto generated classes Table Filter – Use to import a subset of tables Schema Filter – Only default schema will be imported, use to import other schemas Driver Class – JDBC driver class name, change to use a different jar file name for import Dialect – Java class name used to map SQL names for Hibernate

8 Testing your connection
Define Data Testing your connection Test Connection – use to verify connection parameters Import – imports the database into WaveMaker, can take several minutes depending on size of database Close – closes the settings dialog box without importing the database Be sure to always test your connect before importing to verify your connection parameters. Import – actually queries the database created

9 Define Data What are LiveTables? All of the data models available to your application are listed in the tree on the left side of the LiveTables editor Under each data model, all of the LiveTables for that model are listed LiveTable is just a fancy name for a table in which WM has automated producing CRUD functionality Select a LiveTable to see its details in the right side of the editor

10 Managing LiveTables New – creates a new table in the data model
Define Data Managing LiveTables New – creates a new table in the data model Delete – removes a table from the data model New and Delete table only affect the data model and do not change the underlying database unless exported Import Database – brings up the Import Database dialog box to import a new database Connection Settings – brings up dialog box to which allows you to manage the connections to all of the databases used by this application.

11 Managing Database Connection Settings
Define Data Managing Database Connection Settings Connection settings for all databases can be accessed through one dialog box Save – save changed settings Re-Import – overwrites data model Export – pushes data model to database. BE CAREFUL WHEN USING THIS OPTION AS IT WILL DROP AND RECREATE THE TARGET SCHEMA – DATA WILL BE LOST! Will cover exporting in further detail later in this chapter

12 Re-importing a Database
Define Data Re-importing a Database Recommended that database changes be made on the database and changes be re-imported Minor changes should be handled appropriate through the application. Relationships, Addition or deletion of a tables, columns If major changes are made you may need to check functionality within the application to make sure things still work correctly. Changing column names and relationships

13 Define Data Exporting a Database Exporting a data model from WaveMaker to your database is possible This is recommended for test or new databases only All tables are dropped and recreated You will lose data!

14 General Settings Define Data
Save – any changes made in this editor must be saved using this icon Database – value is dependent on type of database system, generally refers to name space that contains the table Package – Java package name of the data model, if changed will affect all LiveTables in that data model Table Name – table name in the database that the LiveTable references Entity Name – name of the LiveTable All of these fields can be edited

15 General Settings Define Data
Dynamic Insert – if checked, SQL statement sent by WaveMaker to the database does not include empty fields Dynamic Update – if checked, columns that have null values are excluded from SQL update statements Dynamic Insert and Dynamic Update map directly to the Hibernate settings dynamic-insert and dynamic-update. Refresh Entity – if checked, a SQL select statement is run to fetch the row just inserted or updated to include any fields that are set by the underlying database (Example: Date Time Stamps) Dynamic Insert: In WaveMaker Studio, by default, the SQL statement for an insert includes all columns, assigning a null value to any field that doesn’t have a value. When you do an “insert” operation, all empty fields are inserted with “null” values, even if the column has a default value. To get default values to work, check the Dynamic Insert check box. When Dynamic Insert is turned on, the SQL statement that WaveMaker Studio sends to the database does not include empty fields. Dynamic Update: In WaveMaker Studio, by default, the SQL statement for an update includes all columns, assigning a null value to any field that doesn’t have a value. Depending on how the database handles this, fields with existing values might be updated to have a null value. If the Dynamic Insert check box is checked, then columns that have null values are excluded from the SQL update statements. Refresh Entity: Checking Refresh Entity means that we will do a select after each insert and update. If you have default values for insert (like current date), or a trigger that runs on update, then after an insert or update the values in your database will be different than the values we have in memory. In some cases this is not a problem, since the in-memory values will just be thrown away. But if you want to display the database-generated values on the client, you need to select Refresh Entity. When Refresh Entity is selected, we run a SQL select statement to fetch the row you just inserted or deleted. We then update the in-memory values with the ones returned by the SQL select. This option is unchecked by default because of the performance cost of doing a select after every insert or update. NOTE: A database-generated primary key is always returned to the client after an insert. You do not need to select Refresh Entity to get that. NOTE: Dynamic Insert and Dynamic Update map directly to the Hibernate settings dynamic-insert and dynamic-update.

16 Managing Column’s Define Data Add – adds a column
Delete – remove selected column Name – column name Primary Key – if checked, column is the primary key, can only have 1 primary key per LiveTable Foreign Key – true or false Type – column data type Not Null – if checked, column cannot hold null value In the tree, the PK field is represented with a *

17 Managing Columns Define Data
Length – maximum number of characters in column Precision - maximum number of digits used, only for numeric data types Generator – if the column is a primary key, specifies the method of key generation Assigned, identity, sequence, native Params – if a generator is selected, specifies the parameters for that generator, if any Generator types: assigned lets the application assign an identifier to the object before save() is called. This is the default strategy if no <generator> element is specified. identity supports identity columns in DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL. The returned identifier is of type long, short or int. sequence uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in Interbase. The returned identifier is of type long, short or int native picks identity, sequence or hilo depending upon the capabilities of the underlying database

18 Managing Relationships
Define Data Managing Relationships Add – create a relationship to another LiveTable Delete – remove an existing relationship Name – relationship name Related Type – LiveTable referenced Cardinality – to-many or to-one Table Name – name of table in database referenced Column Names – column in LiveTable that is related Cascade Options – method to push changes from master Relationships can be added at the model level and not exported back in the case where the underlying data model does not have the needed relationships defined In the tree, left angle bracket (<) represents one to many relationship In the tree, right angle bracket (>) represents one to one relationship Cascade Options – none, save-update, persist, merge, delete, remove, lock, replicate, evict, refresh, delete-orphan, all

19 Questions?

20 Exercise 2 Import classicmodels database
These data models will be used in future exercises.


Download ppt "WaveMaker Visual AJAX Studio 4.0 Training"

Similar presentations


Ads by Google