wavemaker visual ajax studio 4.0 training basics: building your first application database basics

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

Upload: graciela-noy

Post on 02-Apr-2015

245 views

Category:

Documents


3 download

TRANSCRIPT

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

WaveMaker Visual AJAX Studio 4.0 Training

Basics: Building Your First ApplicationDatabase Basics

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

2

Building your First Application

Import data in Live Tables

Drag-n-drop widgets in Page Designer

Connect data to widgets in Page Designer

1.Define Data

2. Build GUI

3. Bind data to GUI

Can also import Java and Web Services

Can deploy app to any Java server

** Steps 1 and 2 can be reversed – you can design first then add data

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

3

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

1.Define Data

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

4

Supported Databases

● All databases that are supported by Hibernate are supported in WaveMaker– http://www.hibernate.org/

● Built-in Support:– PostGreSQL

– MySQL

– Oracle

– DB2

– SQL Server

– Hypersonic SQL DB (HSQLDB)

1.Define Data

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

5

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

1.Define Data

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

6

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

1.Define Data

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

7

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

1.Define Data

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

8

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

1.Define Data

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

9

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

1.Define Data

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

10

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.

1.Define Data

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

11

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!

1.Define Data

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

12

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

1.Define Data

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

13

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!

1.Define Data

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

14

General Settings

● 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

1.Define Data

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

15

General Settings

● 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)

1.Define Data

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

16

Managing Column’s

● 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

1.Define Data

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

17

Managing Columns

● 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

1.Define Data

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

18

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

1.Define Data

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

19

Questions?

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

20

Exercise 2

● Import classicmodels database