Oracle 1Z0-898 Online Practice
Questions and Exam Preparation
1Z0-898 Exam Details
Exam Code
:1Z0-898
Exam Name
:Java EE 6 Java Persistence API Developer Certified Expert
Certification
:Oracle Certifications
Vendor
:Oracle
Total Questions
:63 Q&As
Last Updated
:Dec 12, 2021
Oracle 1Z0-898 Online Questions &
Answers
Question 1:
Entity lifecycle callback methods may be defined in which three classes? (Choose three)
A. Embedded classes B. Entity classes C. Abstract classes D. Entity listener classes E. Mapped superclasses F. Concrete non-entity superclasses
B. Entity classes D. Entity listener classes E. Mapped superclasses
Reference:http://stackoverflow.com/questions/3747268/how-to-inject-a-springs-service-bean-into- a-jpa-entity(See the answer, first paragraph)
Question 2:
An entity person is mapped to a table PERSON and has a collection-valued persistence field otherUsedNames that stores names used by a person. The other used Names field is mapped to a separate table called NAMES. Which code fragment correctly defines such field?
A. @ElementCollection (name = "NAMES") Protected set otherUsedNames = new HashSet () ; B. @Element collection @ElementTable (name = "NAMES") Protected set otherUsedNames = new HashSet () ; C. @ElementCollection @SecondaryTable (names = "NAMES") Protected set otherUsedNames = new HashSet () ; D. @ElementCollection @CollectionTable(names = "Names") Protected set otherUsedNames = new HashSet () ;
D. @ElementCollection @CollectionTable(names = "Names") Protected set otherUsedNames = new HashSet () ;
Which statement is correct about the Java Persistence API support for the SQL queries?
A. SQL queries are NOT allowed to use parameters. B. The result of an SQL query is not limited to entities. C. Only SELECT SQL queries are required to be supported. D. SQL queries are expected to be portable across databases.
B. The result of an SQL query is not limited to entities.
Question 4:
A developer has created an application managed entity manager. Which statement is correct?
A. A new persistence context begins when the entity manager is created. B. A new persistence context begins when a new JTA transaction begins. C. A new persistence context begins when the entity manager is invoked in the context o\ transaction. D. A new persistence context begins when the entity manager is invoked in the context of a resource-local transaction.
B. A new persistence context begins when a new JTA transaction begins.
The developer has defined the following entity class office:
Which of the following attributes will be in corresponding generated static metamodel class for the rooms' field?
A. Public static volatile CollectionAttribute rooms; B. Public static volatile ListAttribute rooms; C. Public static volatile ListAttribute rooms; D. Public static volatile SingleAttribute rooms;
B. Public static volatile ListAttribute rooms;
Question 6:
Given the following code:
Public void create () {
try {
doA () {
} catch (PersistenceException e) {}
try (doB) ();
} catch (PersistenceException e) {}
}
Calling method doA will cause an NonUniqueResultException to be thrown. Calling method doB will cause an EntityExistsException to be thrown.
What two options describe what will happen when the create method is called within an application ' uses container managed transactions? (Choose two)
A. Method doB will never be called. B. The current transaction will continue after doA executes. C. The current transaction will continue after doB executes. D. The current transaction will be marked for rollback when doA is called. E. The current transaction will be marked for rollback when doB is called.
C. The current transaction will continue after doB executes. E. The current transaction will be marked for rollback when doB is called.
Question 7:
Which EntityManager API will lock entity x with a pessimistic lock?
A. em.lock(x, LockModeType.WRITE) B. em.lock(x, LockModeType.PESSIMISTIC) C. em.lock(x, LockModeType.PESSIMISTIC_READ) D. em.lock(x, LockModeType.OPTIMISTIC_FORCE_INCREMENT)
A developer is writing an application with three java Persistence API entities: order, customer, and Address. There is a many-to-one relationship between order and customer, and a one to-many relationship between customer and Address.
Which two Criteria queries will return the orders of all customers who have an address whose value specified by the String parameter postalcode? (Choose two)
A. String postalCode = . . . Criteria Builder cb = . . . CriteriaQuery cq = cb.createQuery (Order.class); Root order = cq.from(order.class); Join customer = order.join(Order_.customer); Root order = cq.from (Order.class); Join address = customer join (Order_.customer) cq.where (cb.equal (address.get(Address_.postalCode), postalCode)); cq.select (order). Distinct (true); // query execution code here . . . B. String postalCode = . . . Criteria Builder cb = . . . Root order = cq.from (Order.class); order.join (order_. customer).join(Customer_.addresses); cq.where (cb.equal (address.get(Address_.postalCode), postalCode)); cq.select (order). Distinct (true); // query execution code here C. String postalCode = ... CritetiaBuilder cb = ... Root order = cq - from (Order . class) , Join address = order.join(Customer_.addresses); cq.where(ct>.equal(address.get(Address_.postalCode), postalCode)); cq-select(order).distinct(true); // query execution code here . . . D. String postalCode = ... CriteriaBuilder cb = ... Root order = cq- from (Order . class ) , Join address = order . join (Order_. customer) -join (Customer_.addresses); cq.where
C. String postalCode = ... CritetiaBuilder cb = ... Root order = cq - from (Order . class) , Join address = order.join(Customer_.addresses); cq.where(ct>.equal(address.get(Address_.postalCode), postalCode)); cq-select(order).distinct(true); // query execution code here . . . D. String postalCode = ... CriteriaBuilder cb = ... Root order = cq- from (Order . class ) , Join address = order . join (Order_. customer) -join (Customer_.addresses); cq.where
Question 9:
A developer needs to include a set of managed classes in a persistence unit. Which two solutions are correct? (Choose two.)
A. Place the class files in the orm.xml file. B. Place the class files in the root of the persistence unit. C. Place the class files in any mapping file that is included on the classpath. D. Place the class files in any jar on the classpath that is included in the persistence unit.
A. Place the class files in the orm.xml file. B. Place the class files in the root of the persistence unit.
Given a set of CMT bean methods with the following transaction attributes: Method M1 = SUPPORTS Method M2 = REQUIRED Method M3 = NOT_SUPPORTED Method M4 = REQUIRES_NEW And the following method invocation sequence: Method M1 invokes Method M2 Method M2 invokes Method M3 Method M1 invokes Method M4 If Method M1 is invoked by a method that does NOT have a transaction context, which describes a possible scenario?
A. Method M1 : no transaction Method M2 : new transaction Method M3 : no transaction Method M4 : new transaction B. Method M1 : no transaction Method M2 : Container throws TransactionNotSupportedException C. Method M1 : no transaction Method M2 : runs in same transaction as M1 Method M3 : container throws TransactionNotSupportException D. Method M1 : no transaction Method M2 : new transaction Method M3: Container throws TransactionNotSupportException.
B. Method M1 : no transaction Method M2 : Container throws TransactionNotSupportedException
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Oracle exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your 1Z0-898 exam preparations
and Oracle certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.