Enterprise JavaBeans Flashcards

1
Q

What is an Enterprise JavaBean (EJB)?

A

An Enterprise JavaBean is a component written in Java.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

(3 answers)

What are the types of component in v3 of Enterprise JavaBeans (EJB)?

A
  • Session beans
  • Message-driven beans
  • Entity classes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

(4 answers)

What are session beans?

A
  • Part of the javax.ejb package
  • Provide business logic
  • Run inside an EJB container (a runtime environment)
  • Client communicates with the data via the session bean
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

(2 answers)

What are the types of session bean?

A
  • Stateful session beans
  • Stateless session beans
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are stateful session beans?

A

Stateful session beans keep state across multiple method calls.

They are either ready, non-existent or passive (passive when written to disk, goes back to ready when read from disk).

(e.g. shopping cart)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are stateless session beans?

A

Stateless session beans discard the state after each method call.

They are either ready or non-existent.

(e.g. a database query)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

(4 answers)

What are entity classes?

A
  • Part of the javax.persistence package
  • Provide business data
  • Capture the persistent business entities stored in a database
  • Correspond to a table in a database
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are entities?

A

Entities are instances of an entity class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are entity managers?

A

Entity managers are used to manage entities and are part of the javax.persistence package.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

(2 answers)

What are the types of entity manager?

A
  • Application-managed
    • Explicitly created and closed by the application
  • Container-managed
    • Implicitly created and closed by the EJB container
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are transfer objects?

A

Transfer objects represent the client’s view of data and are suitable for data transfer between session beans and clients.

They contain all necessary information in their instance variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the differences between entities and transfer objects?

A

Entities:

  • Reflect the way data is organised in the database
  • Suitable for data transfer between the database and session beans
  • May contain confidential information that should not be accessible to clients

Transfer objects:

  • Represent the client’s view of data
  • Suitable for data transfer between session beans and clients
  • Only include information that is relevant to clients
  • Can aggregate information stored across different entities, to match the way a client views information
How well did you know this?
1
Not at all
2
3
4
5
Perfectly