Notes3-1.doc

towerdevelopmentData Management

Dec 16, 2012 (4 years and 6 months ago)

277 views


1

C
C
S
S
4
4
5
5
4
4


C
C
L
L
A
A
S
S
S
S


N
N
O
O
T
T
E
E
S
S


F
F
O
O
R
R


W
W
E
E
D
D
N
N
E
E
S
S
D
D
A
A
Y
Y
,
,


1
1
0
0
/
/
8
8
/
/
2
2
0
0
0
0
3
3


SQL



SQL stands for
S
tructured
Q
uery
L
anguage.



The purpose of SQL is to talk to the Database Management System (DBMS) which wraps a
database. All DBMSs implement some form of SQL.



For the most common statements, d
ifferent implementations usually vary only in minor ways
from the SQL standard.



The important SQL statements to know are:

o

SELECT


This statement is used to pull data out of the database

o

INSERT


This statement is used to insert rows into a table

o

UPDATE


This statement is used to change specific rows in a table

o

DELETE


This statement is used to delete specific rows in a table

o

CREATE


This statement is used to create databases or tables

o

DROP


This statement is used to delete databases or tables



A good re
source for SQL is
SQL in a Nutshell
, by Kevin Kline with Daniel Kline, published
by O’Reilly. It covers the SQL standard, plus 2 commercial implementations (Microsoft
SQL Server and Oracle) and 2 open source implementations (MySQL and PostgreSQL).

Enterpr
ise Architecture



“Architecture” is the overall schema or view of how things are put together. For example,

o

Computer Architecture is the design of the computer system.

o

Software Architecture is the design of a software system, for example, a hierarchy of
cl
asses.



“Enterprise” generally has to do with business, multiple systems working together, money,
etc.



“Enterprise Architecture” is multiple software architectures that work together for a common
purpose.


2

Enterprise Java Beans (EJBs)



A Java Bean

o

is a fully
encapsulated class, which means:



all variables are private



there are “get” and “set” methods for each variable (or “is” and “set” methods
in the case of Boolean variables), so that the values of the variables are under
the complete control of the programme
r who writes the class

o

contains business logic, as opposed to display logic



Enterprise Java Beans (EJBs) are not very similar to Java Beans. Whereas Java Beans can
provide basically any functionality, EJBs are specifically designed to encapsulate and
mana
ge all business logic.



An EJB is a special Java object which extends a specific class



EJBs are part of the Java 2 Enterprise Edition (J2EE)



All EJBs provide 8 built
-
in features:

o

Persistence



EJBs automatically save data out somewhere (you can configure wher
e)



You don’t have to make direct database calls; the EJB will write to the
database when the database is not busy, so program execution doesn’t have to
wait for the database write

o

Transactions



sets of statements which are atomic



commits and rollbacks are p
rovided for

[Java has two APIs related to transaction management: Java Transaction API
(JTA) and Java Transaction Service (JTS), both of which can be complicated to
use, as opposed to the ease with which transactions can be done in an EJB.]

o

Security


EJB
s can be configured so only specific user(s) can access them

o

Error handing


there are specific EJB exceptions

o

Components


EJBs are separate, easily “reusable” business logic components, many
of which can talk to each other; many have already been written
.


3

o

Scalability

o

Portability


EJBs are portable from one OS to another, so the same EJBs can run on
different app. servers

o

Manageability


a manager has access to an EJB server, which provides nice GUI
dialog boxes to manage, deploy and undeploy (i.e., block

access to) EJBs



Implementations of EJB servers are generally very expensive (except JBoss, which is free,
but not very powerful).

Problems with EJBs



EJBs are expensive



EJBs are “heavy”

o

All of the above features are built into
every

EJB


whether you need
them or not


which causes them to run slowly.

o

They are difficult to use.

o

They are difficult to deploy.

o

The different EJB servers are very different


i.e., knowing one server well doesn’t
mean you know much at all about another.



For these reasons, EJBs ar
e not used as much as they were at one time.

Why use EJBs?



If you need all the features they provide.



For example, users might include:

o

Banks, stock market, or any enterprise involving a lot of money

o

Defense, or any enterprise for which security is highly
important

3 Kinds of EJBs



Entity beans


these talk to the database, and are used to persist data (as the book says, an
entity bean represents data in a database, and its lifespan is as long as the data it represents).



Session beans


these maintain state,

can talk to entity beans, and are used to store data
(similar to sessions in JSPs; its lifespan is until the current client goes away).


4



Message
-
drive beans

o

Provide for asynchronous interprocess communication (IPC) in EJBs:











Message
-
driven
beans work in the middle


o

Asynchronous communication means that when Process 1 (P1) sends a message to
Process 2 (P2), it gets sent to the mailbox, and Process 1 assumes that Process 2 has
received it. Process 2 receives notification that there is a messa
ge for it in the
mailbox, and it then accepts the message.

Further Comments about EJBs



EJBs are not doing as well as they used to, but they are good to know about.



EJBs can work with any kind of client (e.g., CORBA, RMI, etc.)



P1

“Mailbox”