Create a new Project
- Open JDeveloper and use "Default Role".
- Click File : New and select General : Applications : Generic Application.
- Give application name and directory where you want to store the source files and click next.
- Give project name and finish. This will create a new application and new project where we can model DB schema.
Create DB Diagram
- Click File : New and select Database Tier : Databse Object : Database Diagram
- Give it a name and save.
Create Offline DB
Offline DB is the JDev version of your actual physical DB. You can make changes to offline DB and then propage to the online DB or any other DB where you need those changes.
- Click File : New and select Database Tier : Offline Databse Object : Offline Database
- Give it a name and package and save.
Import existing objects to Offline DB
You can start from sctatch and create objects into Offline DB or if you already have some tables, views and other objects, you can import into Offline DB. Let us use scott/tiger schema to import some of the existing tables and then modify offline DB for changes we want.
- Click File : New and select Database Tier : Offline Databse Object : Copy database objects to a project.
- In Step 1 of 5, create a new DB connection to using TNS where you have your scott schema and click next.
- In Step 2, keep defaults and click next.
- In Step 3, click on Query to see what all objects are available. Click on Filter Type to select what type of objects you want to serach.
- Select EMP, DEPT, SALGRADE and BONUS in available list and click ">" arrow to move them to selected list. Click Next
- In Step 4, choose CREATE and click next.
- Click Finish on Step 5. You can see the objects in Offline DB that you just imported.
- Drag-And-Drop all tables onto the DB Digram created above. Now you have Offline DB and diagram ready for edits.
Adding PK and FK to tables
- Double click on EMP table in offline DB or diagram to open the table editor.
- Choose Primary Key and Move EMPNO from available to selected columns.
- Double click on DEPT table in offline DB or diagram to open the table editor.
- Choose Primary Key and Move DEPTNO from available to selected columns.
- Click on "Foreigh Key" under component palette to create FK relationship between DEPT and EMP tables.
- Click on DEPT.DEPTNO and then click on EMP.DEPTNO. This will show up FK dialog. Accept the defaults.
- Notice that the 0..1 to * relationship is captured in the DB diagram.
Modify table columns
- Click on the BONUS table in DB diagram. Notice a blue row highlighted.
- Click on the blue row again and it will add a new column with default name and datatype.
- Change that to EMPNO : NUMBER(4, 0) and click somewhere else in the diagram. This adds a new column to table.
- Click on ENAME and press "Delete" so that that column is deleted from the table.
- Select EMPNO, right click and select "Add to Primary Key". This is another way to set PK on table.
- Add a FK from EMP to BONUS with EMPNO.
- Drag-And-Drop Table from component palette onto the diagram. Choose Application Project.
- Give the talbe name = LOCATIONS
- Add three columns LOC : VARCHAR2(13 BYTE), LNAME : VARCHAR2(13 BYTE), LDESC : VARCHAR2(100 BYTE).
- Make LOC as PK for table.
- Add a FK relationship with DEPT.LOC column.
Apply the changes to Online DB
- Right click on the diagram and select "Synchronize with Database : Generate TO : ".
- Choose options as ALTER and finish the wizard.
- Verify your DB by connecting to it and checking if changes are applied successfully or not.
- Right click on the diagram and select "Synchronize with Database : Generate TO : SQL Script".
- Select "CREATE" as option. This generates DDL script that can be used if you want to apply same schema on other DB.
written by dimple , November 25, 2009
written by dissertation help , October 29, 2010
written by ChavezMarcy , July 27, 2011
written by http://www.coachoutletsstoreonlines.net/ , September 06, 2012
written by http://www.coachs-factoryoutletonlines.com/ , September 06, 2012
written by http://www.michaelkorsfactoryoutlets-discounts.com/ , October 31, 2012
written by b******y outlet , November 08, 2012