File attachment using Adf faces, EJB3 and Oracle XE database Part I
Usecase:
I want to associate files with employees (PERSON). I will have employees(PERSON) with their associated files which will hold the more information for that employees (PERSON) like (employee’s picture, list of his dependant, his Resume etc)
My ERD will have PERSON and ATTACHMENT tables, and a join table between PERSON and ATTACHMENT that is PERSON_ATTACHMENT.
The relation between PERSON AND ATTACHMENT is ONE TO MANY, A single employee (PERSON) can have many attachments.
Step # 1 Creating tables in Oracle database XE
Let’s first create the Tables in Oracle XE Database.
Open your Oracle Database XE by clicking on “Startup” select “Oracle Database 10g Express Edition” and then click on “Go to Database Home page”
Login to Oracle Database XE.
Creating PERSON Table
Open your Oracle Database XE by clicking on “Startup” select “Oracle Database 10g Express Edition” and then click on “Go to Database Home page”
Login to Oracle Database XE.
Creating PERSON Table
PERSON table |
PERSON table also create sequence for PERSON table |
PERSON table |
Create Attachment table with three columns "ATTACHMENT_ID", "FILE_CONTENT" & "FILE_NAME"
ATTACHMENT table, also create sequence for attachment table |
ATTACHMENT table |
Create join table between PERSON and ATTACHEMTN as "PERSON_ATTACHMENT".
PERSON_ATTACHMENT table |
PERSON_ATTACHMENT table, make composite primary key |
Create Foreign keys |
Create Foreign keys |
PERSON_ATTACHMENT table |
Following are the steps to remove the triggers.
Remove these triggers as follows
To be continue-->
Comming up next
Step II Creating Entities from Database tables, Creating Session beans
Comments
Post a Comment