Java Persistence API

Access: Public Instant Grading

Start FlashCards Download PDF Quiz Series Learn

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now
The objective of this session is to introduce the subject of software engineering. When you have read this session you will understand what software engineering is and why it is important, know the answers to key questions which provide an introduction to software engineering, understand ethical and professional issues which are important for software engineers.

Introduction

Virtually all countries now depend on complex computer-based systems. More and more products incorporate computers and controlling software in some form. The software in these systems represents a large and increasing proportion of the total system costs. Therefore, producing software in a cost-effective way is essential for the functioning of national and international economies.

Software engineering is an engineering discipline whose goal is the cost-effective development of software systems. Software is abstract and intangible. It is not constrained by materials, governed by physical laws or by manufacturing processes. In some ways, this simplifies software engineering as there are no physical limitations on the potential of software. In other ways, however, this lack of natural constraints means that software can easily become extremely complex and hence very difficult to understand.

Software engineering is still a relatively young discipline. The notion of ‘software engineering’ was first proposed in 1968 at a conference held to discuss what was then called the ‘software crisis’. This software crisis resulted directly from the introduction of powerful, third generation computer hardware. Their power made hitherto unrealisable computer applications a feasible proposition. The resulting software was orders of magnitude larger and more complex than previous software systems.

Early experience in building these systems showed that an informal approach to software development was not good enough. Major projects were sometimes years late. They cost much more than originally predicted, were unreliable, difficult to maintain and performed poorly. Software development was in crisis. Hardware costs were tumbling whilst software costs were rising rapidly. New techniques and methods were needed to control the complexity inherent in large software systems.

These techniques have become part of software engineering and are now widely although not universally used. However, there are still problems in producing complex software which meets user expectations, is delivered on time and to budget. Many software projects still have problems and this has led to some commentators (Pressman, 1997) suggesting that software engineering is in a state of chronic affliction.

As our ability to produce software has increased so too has the complexity of the software systems required. New technologies resulting from the convergence of computers and communication systems place new demands on software engineers. For this reason and because many companies do not apply software engineering techniques effectively, we still have problems. Things are not as bad as the doomsayers suggest but there is clearly room for improvement.


Or take a topic-wise Quiz by choosing one of the following topics:

Start Quiz Download PDF
Start Quiz Download PDF
Quiz PDF eBook: 
Java Persistence API
Download JPA Quiz PDF eBook
22 Pages
2010
English US
Educational Materials



Sample Questions from the Java Persistence API Quiz

Question: In which life cycle state the JPA entity class is synchronized with the database?

Choices:

New

Managed

Synchronized

Detached

Removed

Question: Given the code snippet below, which of the following statements are true?

Choices:

At line 1 the user instance is a managed Entity

At line 1 the user instance is a new Entity

At line 1 a new record will be inserted in the user table

At line 2 the entityManager will immediately reflect user name change to the database

At line 3 the entityManager will immediately reflect user name change to the database

Question: How to declare JPA Entity class?

Choices:

Write a private final Entity class named after the mapped table

Annotate the class with @Entity

Annotate the primary key attribute or its getter method with @Id

Define private attributes to map the table columns

Write the finalize method

Question: which of the following is NOT a jpa entity manager method?

Choices:

persist

flush

contains

detach

find

Question: Which method of the jpa entity manager would you use to force synchronizing the persistence context from the database?

Choices:

synchronize()

flush()

refresh()

persist()

Question: What causes the entity manager to move an Entity instance from the managed to the detached state?

Choices:

Invoke the detach() method of the entity manager on the instance

Invoke the remove() method of the entity manager on the instance

Invoke the unsynchronize() method of the entity manager on the instance

when the associated persistence context ends at the end of the transaction boundary.

Question: What are the possible state transitions for an Entity instance ?

Choices:

from managed to detached

from detached to removed

from detached to new

from new to detached

from managed to removed

Question: What is the impact of marking an attribute in a JPA Entity class with @Transient annotation?

Choices:

This attribute will should not be serialized by the EJB container

This attribute will should not be persisted by the EJB container

This attribute will should not be garbage collected by the EJB container

Question: What causes the entity manager to move an Entity instance from the detached to the managed state?

Choices:

Invoke the persist() method of the entity manager on the instance

Invoke the merge() method of the entity manager on the instance

Invoke the manage() method of the entity manager on the instance

Invoke the remove() method of the entity manager on the instance

Question: Given the code snippet below, which of the following statements are true?

Choices:

At line 1 the user instance is a managed Entity

At line 1 the user instance is a detached Entity

At line 1 the find method will return null if the input userID is not found

line 3 is mandatory to synchronize the changes done at line 2 to the database

line 4 is mandatory to synchronize the changes done at line 2 to the database

Question: You want to write a JPA Entity class to model a databank table named COOPERATE_USER. Each user is uniquely identified in this table by his or her social security number SSN. Along with SSN the system keeps user name, job, address and birth date. How to declare such JPA Entity class?

Choices:

Write a CooperateUser public class

Annotate the CooperateUser class with @Table(name=" COOPERATE_USER")

Annotate the CooperateUser class with @Entity

The CooperateUser class must implement Serializable

Define private attributes ssn, job, name, addess and birthdate

Annotate the ' name' attibute with @Id

Start FlashCards Download PDF Quiz Series Learn
Courntey Hub
Start Test
Lakeima Roberts
Start Quiz
JavaChamp Team
Start Quiz
Sean WiffleBoy
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-persistence-api-jpa" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>