Oracle 1Z0-860 Self Study, 100% Success Rate Oracle 1Z0-860 Practice Questions With Accurate Answers

Now,Flydumps has publised the new version of Oracle 1Z0-860 exam dumps with new added exam questions.Also the latest Oracle 1Z0-860 PDF and VCE dumps with VCE test engine for free download,and the new Oracle 1Z0-860 practice tests ensure your exam 100% pass.Visit www.Flydumps.com to get more exam dumps!

QUESTION: 1
Given the following stateful session bean:

10.
@Stateful

11.
@TransactionAttributefJransactionAttributeType. SUPPORTS)

12.
public class VideoBean implements Video {

13.
// insert code here

14.
public void methodAO {}
15.}
Assuming no other transaction-related metadata, which code can be added at Line 13 to
guarantee that business method methodA will execute only if invoked with an active
transaction?

A. @TransactionAttributefJ

B. @TransactionManagement(TransactionAttributeType. CONTAINER)

C. @TransactionAttribute(TransactionAttributeType.MANDATORY)

D. @TransactionAttributeO”ransactionAttributeType.REQUIRES_NEW)

Answer: C
QUESTION: 2
Given the following client-side code that makes use of the session bean Foo:

10.
@EJB Foo beanl;

11.
@EJB Foo bean2; //more code here

20.
booleantestl = beanl.equals(beanl);

21.
booleantest2 = beanl.equals(bean2); Which two statements are true? (Choose two.)

A. If Foo isstateful,testlistrue, and test2 is true.
B. IfFoo is stateful, testlis true,andtest2isfalse.
C. IfFoo is stateless, testl is true, and test2 is true.
D. IfFoois stateful, testl is false, and test2 is false.
E. If Foo isstateless, testl istrue,and test2 is false.
F. If Fooisstateless, testl is false, andtest2is false.

Answer: B, C
QUESTION: 3
Which statement about entity manager is true?

A. A container-managed entity manager must be a JTA entity manager.
B. An entity manager injected into session beans can use either JTA or resource-local transaction control.
C. An entity manager created by calling the EntityManagerFactory.createEntityManager method always uses JTA transaction control.
D. An entity manager obtained through resource injection in a stateful session bean can use a resource-local EntityTransaction for transaction control

Answer: A
QUESTION: 4
Which statement is true about the use of a persist operation in a transaction?

A. If a user persists a detached object it always becomes managed.
B. The persist operation on an entity always cascades to its related entities.
C. If a user persists a new entity with an existing primary key the transaction will fail.
D.  If a user  persists a  managed entity an  exception  may be thrown by the  persist operation.

Answer: C
QUESTION: 5 A developer writes a stateless session bean with one local business interface and with container- managed transactions. All business methods have transaction attribute REQUIRED. The bean has an injected field sessionCtx of the type SessionContext. Which two operations are allowed in a business method of the bean? (Choose two.)
A. sessionCtx. getEJBObject
B. sessionCtx.setRollbackOnly
C. sessionCtx. getMessageContext
D. sessionCtx. getBusinessObject
E. sessionCtx. getEJBLocalObject
Answer: B, D

QUESTION: 6 A developer implements a session bean with a method doStuff which behaves differently depending on the caller’s  security role. Only  users  in security  roles  “ADMIN” and “USER” are allowed to call the method. Assume that there is no security-related metadata in the  deployment descriptor. Which two, taken in  combination, are appropriate to accomplish this? (Choose two.)
A. Annotate method doStuff with @PermitAII.
B. AnnotatemethoddoStuff [email protected]({“ADMIN”,”USER”})
C. If EJBContext.getCallerPrincipal returns role “ADMIN”, implement thebehaviorfor users in role ADMIN.
D. If EJBContext.isCallerlnRole(“ADMIN”) returns true, implement the behavior defined for users in role “ADMIN”.

Answer: B, D
QUESTION: 7 Which Java Persistence query uses the aggregate function correctly, assuming that chairs field is of type int?
A. SELECT ANY(r. chairs) FROM Room r
B. SELECT NEW Integer(MAX(r. chairs)) FROM Room r
C. SELECT r FROM Room r WHERE r.chairs > AVG(r.chairs)
D. SELECT c FROM Chair c WHERE LOCATE (c.type, lazyboy) > -1

Answer: B
QUESTION: 8
Given:
11..Entity public class X{

12.
@ld int id;

13.
Y y;
14.}
A public class Y with NO Java Persistence annotations is defined  in the same
package. Which statement  is correct  about these  classes  if NO other annotations
and mapping  descriptors are provided?

A. Class Y must be serializable.
B. ClassYmust be marked as an entity.
C. The entity X is notdefinedcorrectly.The field y must be marked as @Lob.
D. ClassY must be accessedbyapersistenceapplication throughapublicinterface.

Answer: A
QUESTION: 9 A developer creates a stateless session bean. This session bean needs data from a remote system. Reading this data takes a long time. Assume that the data will NOT change during the lifetime of the bean and that the information to connect to the remote system is defined in JNDI. Which statement describes how to manage the data correctly?
A. Readthe datain the bean’s constructor.
B. The datacan only bereadinthebean’s business methods.
C. Read thedatain a method which is annotated [email protected]
D. Read the data in a method which is annotated with @Post Activate.
E. Readthedata ina methodwhich is annotated with (5)PostConstruct.

Answer: E
QUESTION: 10
An enterprise bean has security permissions set up using declarative security features.
Under which two conditions can a client be guaranteed to have permission to invoke a
business method on the enterprise bean? (Choose two.)

A. The Application Assembler has marked the enterprise bean methodasunchecked.
B. The client’s principalhas beenassigned  a securityrolewithpermissionto  invokethe method.
C. The Application Assembler has set the security-identity deployment descriptor to run- as.
D. TheApplicationAssemblerhas mapped all security role references using the role-link element.
Answer: A, B

QUESTION: 11 An enterprise developer needs to modify the order of interceptor method execution specified by the Bean Provider, but does NOT have access to the bean’s source code. No deployment descriptor was provided  in the ejb-jar  delivered by the Bean  Provider. Which represents the solution to this problem?
A. No solution is possible under these conditions.
B. TheDeployer canadd metadataannotations totheejb-jar.
C. The Application Assembler can add metadata annotations to the ejb-jar.
D. TheSystem Administrator can addinterceptorbinding informationatruntime, using vendorspecific tools.
E. TheApplication Assembler canaddadeployment descriptor totheejb-jarthat includesinterceptor binding information.

Answer: E
QUESTION: 12 A developer writes a session bean which uses several configurable constants. The constants are all defined  as String types in JNDI. This cannot be changed because existing code is using the same JNDI information. One of the constants is a date, represented in string format. This date constant is used in multiple business methods of this session bean, actually as a Date object.  Converting strings to dates is an expensive operation; therefore, the developer wants to do as little converting as possible. Which two scenarios can be  used to prevent  converting from String to Date in every business method? (Choose two.)
A. Loadthe date string in an instance Date type variablebyannotation of the instance variable and let the container autoconvert it to a Datetypeautomatically.
B. Load thedate string in an instance String type variablebyannotation of this instance variableandconvertitto aDatetype object in the beans constructor.
C. Load thedatestringinaninstanceString  typevariableby  annotationof this instance variable and convert it to aDate typeobjectin [email protected]
D. Load the date string in an instance Date typevariableby annotation ofasetter method that takes a String and which carries out the conversion and assigns the value totheinstance variable.
Answer: C, D

QUESTION: 13
Which is a valid PostConstruct method in a message-driven bean class?

A. .PostConstruct
public boolean initQ {return true; }

B. .PostConstruct private static void init0 {}

C. .PostConstruct private void init0 {}

D. .PostConstruct public static void initQ {}

Answer: C
QUESTION: 14 A developer wants to create a JMS message-driven   bean that responds to javax.jms.TextMessage messages. Which two statements are true? (Choose two.)
A. The developer must implement the ejbCreate method.
B. The developer does NOT need to create a business interface for the bean.
C. The developer must implement a method that declares javax.jms.TextMessage as an argument.
D. The message-driven bean class must implement methods of the javax.jms.MessageListener interface.
E. The message-driven bean class must  implement methods of the javax. ejb. MessageDnvenBean interface.

Answer: B, D
QUESTION: 15 A Reader entity has a one-to-many, bidirectional relationship with a Book entity. Two Reader entities are persisted, each having two Book entities associated with them. For example, readeM has booka and bookb, while reader2 has bookc and bookd. Which query returns a Collection of fewer than four elements?
A. SELECT b.reader FROM Book b
B. SELECT r FROM BookbINNER JOINb.readerr
C. SELECTrFROM Reader r INNER JOIN r.booksb
D. SELECTrfrom BookbLEFT JOIN b.readerr LEFTJOINFETCHr.books

Answer: C
QUESTION: 16 A session bean’s business method  throws an exception during execution.  Which two are responsibilities of the Bean Provider when throwing the exception? (Choose two.)
A. For application exceptions, ensure that if the current transaction commits there will be no loss of data integrity.
B. For application exceptions, ensurethatthe current transaction will commit.
C. For system errors, when the client is remote, throw a java.rmi.RemoteException that wraps the original exception.
D. For checked exceptions from which the bean cannot recover, throw an EJBException that wraps the original exception.

Answer: A, D
QUESTION: 17
The ejb-jar file format is a contract between which two EJB role pairs? (Choose two.)

A. Deployer and System Administrator
B. Application Assembler and Deployer
C. Bean Provider and Application Assembler
D. Bean Provider and EJB Container Provider
E. EJB Server Provider and EJB Container Provider
F. Application Assembler and EJB Container Provider

Answer: B, C
QUESTION: 18 Which Java Persistence query uses the aggregate function correctly, assuming that chairs field is of type int?
A. SELECT ANY(r. chairs) FROM Room r

B. SELECT NEW Integer(MAX(r. chairs)) FROM Room r
C. SELECT r FROM Room r WHERE r.chairs > AVG(r.chairs)
D. SELECT c FROM Chair c WHERE LOCATE (c.type, lazyboy) > -1

Answer: B
QUESTION: 19 A developer writes a stateful session bean called FooBean. Which code can be inserted before Line 11 of the FooBean class to define a TYPE-level environment dependency on a JMS Topic?
11.
public class FooBean {

12.

13.
public void fooQ {}

14.
15.}

A. @Resource(type=Topic. class)
B. @Resource(name=”topicRef) private static Topic topic;
C. .ResourceprivateTopic topic;
D. @Resource(name=”topicRef’, type=Topic. class)

Answer: D
QUESTION: 20 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 of a JTA transaction.
D. A new persistence context begins  when the  entity manager is invoked in the context of a resource-local transaction.
Answer: A

QUESTION: 21
Given this Java EE application that uses a JTA application-managed entity manager:

20.
UserTransaction utx = …;

21.
utx.beginQ;

22.
// insert code here

23.
utx.commitQ;
Which two code fragments can be used on Line 22 to persist  an order instance assuming
that all references are properly initialized? (Choose two.

A. em.merge(order); em.flushQ;

B. em.persist(order); em.flushO;

C. em.joinTransactionO; em.persist(order);

D. em = emfcreateEntityManagerQ; em.persist(order);

Answer: C, D
QUESTION: 22 A developer writes two session beans which cooperate. The first session bean, ShoppingCart, collects  orders and is implemented  as a stateful session bean. The second session bean, CalculateDiscount,  is implemented  as a stateless session bean and runs on a different  server. ShoppingCart contains the method getTotalPrice, which calculates the total price of the order in the ShoppingCart, including discounts.
Discounts  are  calculated  by  CalculateDiscount  using  the information  on the
ShoppingCart bean, combi ned  with  data  from a database.   Which   scenario  can
accomplish this?

A. The CalculateDiscount offers a method calculate which is invoked by the ShoppingCart bean passing the this reference.
B. The CalculateDiscount offers a method calculate which is invoked by the ShoppingCart bean. CalculateDiscount accesses the ShoppingCart instance by JNDI lookup.
C. The CalculateDiscount offers a method  calculate which  is invoked  by the ShoppingCart bean passing its reference obtained from the SessionContext.getBusinessObject method.
D. The CalculateDiscount offers a method calculate which is invoked by the ShoppingCart bean. CalculateDiscount accesses the state of ShoppingCart by dependency injection.

Answer: C

QUESTION: 23
A CMT session bean named MrBean is annotated as follows :

21.
@Stateless(name=”MrBean”)

22.
@TransactionAttribute0″ransactionAttributeType.NOT_SUPPORTED)

23.
public class MrBean {

24.
public void storeStuffQ {}

25.
There are no transaction annotations at the method level. Given the following snippet
of an ejb-jar.xml:

23.
<container-transaction>

24.
<method>

25.
<ejb-name>MrBean</ejb-name>

26.
<method-name>storeStuff</method-name>

27.
</method>

28.
<transaction-attribute>Mandatory</transaction-attribute>

29.
</container-transaction>
Which statement is correct about the business methods in MrBean?

A. All methods have transactionattributeREQUIRED.

B. All methodshavetransaction attributeMANDATORY.

C. All methodshavetransaction attribute NONSUPPORTED.

D. Methods with name store Stuff have transaction attributeMANDATORYand all other
methods have transaction attribute REQUIRED.

E. MethodswithnamestoreStuffhavetransaction attribute MANDATORY andall
othermethods have transaction attribute NONSUPPORTED.

F. Methodswithname store  Stuff haveatransaction attribute REQUIRED  andallother
methods have transaction attribute NOT SUPPORTED.

Answer: E
QUESTION: 24
Which four are defined in the EJB specification as a standard EJB role? (Choose four.

A. End Point Provider
B. Persistence Provider
C. NameSpace Provider
D. JSF Interface Provider
E. ApplicationAssembler
F. EJBContainerProvider

G. EnterpriseBeanProvider
Answer: B, E, F, G
QUESTION: 25 The syntax of the ORDER BY clause is defined in the Java Persistence API asorderby_clause ::=ORDER BY orderbyjtem {, orderbyjtem}* Which statement is correct about the use of ORDER BY clauses?
A. Only literals can be specified as an orderbyjtem.
B. Fields or properties of any type can be specified as an orderbyjtem.
C. The ordering must be specified if two or more orderbyjtem methods are provided.
D. If two orderbyjtem methods  are provided  the left orderbyjtem has  the higher precedence.

Answer: D
QUESTION: 26 A developer is writing implementation code for an EJB 3.0 message-driven bean class that processes booking requests. Within  the business logic of the onMessage  method, a temporary problem can occur. In that case the developer wants to make sure that the booking request is processed again in 30 minutes. Which two can the developer select? (Choose two.)
A. Throwa runtimeexception torollbackthetransaction.
B. Call setRollbackOnly on the MessageDrivenContext interface.
C. Makeuseof the TimerService, and implement the TimedObject interface.
D. Make use of the TimerService,implement areprocess method, and annotate it with @Timeout.
E. Throw an application exception, and addtheretry-after attribute to the deployment descriptor.
Answer: C, D
QUESTION: 27

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 M1notransaction MethodM2new transaction Method M3no transaction MethodM4newtransaction
B. Method M1notransaction Method M2Container throws EJBTransactionRequiredException
C. MethodM1new transaction Method M2runs in same transaction as M1 Method M3Container throws TransactionNotSupportedException
D. Method M1no transaction Method M2new transaction Method M3Container throws TransactionNotSupportedException

Answer: A
QUESTION: 28 OldBarBean is a  stateless session bean written to the EJB 2.1 API with remote home interface. OldBarHome and remote component interface OldBar. FooBean is a stateless session bean written to the EJB 3.0 API. OldBarBean and FooBean are the only EJBs packaged in the ejb-jar. The FooBean portion of the ejb-jar. xml also declares an ejb-ref whose ejb-ref-name is ejb/oldBar. The ejb-ref is linked to OldBarBean. There are no other ejb dependencies defined. A business method foo in FooBean needs to access OldBarBean. Which is portable code to achieve this goal?
A. .Remote
private OldBar oldBar;

B. public void fooQ { try {
InitialContext ic = new InitialContextO; Object obj = ic.lookup(“ejb/oldBar”);
OldBarHome OldBarHome =
(OldBarHome) PortableRemoteObject.narrow(obj, OldBarHome.class);
OldBar oldBar = oldBarHome.createO;

C. @EJB private OldBarHome OldBarHome;

public void fooQ {
try {
OldBar oldBar = oldBarHome.createQ;

D. public void fooQ {
try {
InitialContext ic = new InitialContextO; OldBarHome OldBarHome =
(OldBarHome) ic.lookup(“ejb/oldBar”); OldBar oldBar = oldBarHome.createQ;

Answer: C
QUESTION: 29 DRAG DROP Click the Task button. A Department entity is in a one-to-many relationship with an Employee entity. A developer has been asked to write a Java Persistence query to update the set of employees who are in the department ‘HR’ by setting their department to null. Construct a query using the Java Persistence query language to perform this task. Construct a valid Java Persistence query by dragging and dropping the syntax fragements.

Answer: C

QUESTION: 30 A developer implemented a Java class called Store. The class is  annotated correctly  to act as an entity. The developer created a stateless session bean to create, lookup, and remove Store objects. This session bean has a container-managed entity manager injected into field em and a removeStore method with transaction attribute REQUIRED. Given the following code :
32.
public void re move St ore (St ore store) {

33.
em.remove(store); 34.}
What is  a possible  reason that  an HlegalArgumentException  is thrown  at Line  33
when the removeStore method is called by a remote client?

A. Thepassedobject is NOT serializable.

B. Thepassed object is NOT found inthedatabase.

C. The passed object is NOT managed by the entity manager.

D. There is no active transaction to manage the database removal.

Answer: C
QUESTION: 31 A developer is designing a Java Persistence application that is mapped to a set of existing tables. This set includes table EMPLOYEE, DEPARTMENT, and PROJECT. Tables EMPLOYEE and DEPARTMENT do NOT  define any  foreign  key constraints to table PROJECT. Table PROJECT  defines foreign  key constraints with references to tables EMPLOYEE and DEPARTMENT and an extra column called COST. The  table EMPLOYEE is mapped to an entity  Employee and  the table DEPARTMENT to an entity Department.  How can the table PROJECT  be mapped  so the persistence application can be portable?

A. Such sets of tables cannotbemappedandkeep the application portable.
B. Map thetablePROJECT asasecondary table for either the Employee or Departmententity.
C. Map the table PROJECT to bidirectional many-to-many relationships between the Employeeand Departmentusing a Java. util.Mapas the type ofthefield or property.
D. Mapthe tablePROJECT to an entity Projectwith afield or property cost mappedto thecolumn COST and one-to-many relationshipstothis entity in the Employee and the Department.

Answer: D
QUESTION: 32 A CMT session bean named MrBean contains a method storeStuff which is annotated as follows:
22.
@TransactionAttributeO”ransactionAttributeType.REQUIRES_NEW)

23.
public void storeStuffO {
All other methods of this bean have no transaction annotations. Given the following part
of an ejbjar.
xml:

23.
<container-transaction>

24.
<method>

25.
<ejb-name>MrBean</ejb-name>

26.
<method-name>*</method-name>

27.
</method>

28.
<transaction-attribute>NotSupported</transaction-attribute>

29.
</container-transaction>
Which statement is correct about the methods in MrBean?

A. Allmethods of MrBean have transaction attribute REQUIRED.

B. All methodsofMrBean have transactionattribute NONSUPPORTED.

C. MethodstoreStuffhastransactionattributeREQUIRES_NEWandthe other methods have
transaction attribute REQUIRED.

D. Method storeStuff has transaction attribute  NONSUPPORTED and the other
methods  have transaction attribute REQUIRED.

E. Method storeStuff has transaction attribute REQUIRES NEWandthe other
methodshavetransaction attribute NOT SUPPORTTED.

Answer: B

QUESTION: 33 A developer writes an interceptor class called Foolnterceptor containing the following Aroundlnvoke method:
11.
@Aroundlnvoke

12.
public Object intercept(lnvocationContext ctx) {

13.
return “intercepted”; 14.}
Foolnterceptor is applied to a business method in a stateless session bean:

11.
@lnterceptors(Foolnterceptor.class)

12.
public String testzero(int i) {

13.
return (i == 0) ? “zero””not zero”;

14.
}
Which describes the result when a client invokes the testzero method with a value of 1?

A. The intercept method is NEVER invoked.

B. The clientreceivesareturnvalueof “zero”.

C. The client receivesa returnvalue of “not zero”.

D. The client receivesareturn value of “intercepted”.

Answer: D
QUESTION: 34 A developer implements a session bean which acts as a session facade for an application. This means that clients will only see this session bean’s interface which offers the application interface. There are three distinct roles known at development time”user”, “admin”, and “guest”. The majority of the methods will be used by role “user”. All methods must have role permissions active and roles may be added or changed in the future. Which two scenarios are correct? (Choose two.)
A. The developer annotates the bean class with @PermitAII and annotates the methods used by role”guest” or “admin” individually.
B. The developer annotates the bean class with @DenyAII and annotates the methods used by role”user”, “guest”, or “admin” individually.
C. The developer defines individual method permissions for the methods used by roles “user”,”guest”, and “admin” in the deployment descriptor.
D. The developer annotates the bean class with @RolesAllowed(“user”) and annotates the methods used by role “guest” or “admin” individually.
E. Thedeveloper defines a method permission with method name “*” and role “user” and adds individual   method  permissions  for the methods  used by roles “guest” and “admin”  in the deployment descriptor.

Answer: D, E
QUESTION: 35 A User entity is in a one-to-many relationship with a Book entity. Assume that a developer has a function fetchBook(String title) that fetches a Book entity with the given title title. Also assume that the developer has an entity manager em. Which query can be used to return the user that holds the book titled “Java”?
A. em.createQueryfSELECT u FROM User u where :great IN u.books.title”).setParameter(“great”,”Java”)
B. em.createQuery(“SELECT u FROM User u where :great IN
C. books”). setParameter(“great”,fetchBook(“Java”))
D. em.createQuery(“SELECT u FROM User u where :great MEMBER OF
E. books.title”). setParameter(“great” .”Java”)
F. em.createQuery(“SELECT u FROM User u where :great MEMBER OF
G. books”). setParameter(“great”,fetchBook(“Java”))

Answer: D
QUESTION: 36 Given: A session bean Foo uses container-managed transactions The container throws a javax.transaction.TransactionRolledBackException when the doStuff method runs. Which transaction attribute can the doStuff method have for this to occur?
A. NEVER
B. MANDATORY
C. REQUIRES_NEW
D. NOT SUPPORTED

Answer: B
QUESTION: 37 Within a Java EE environment, which annotation can be used to inject an entity manager factory?

A. .Entity
B. .Factory
C. @JTAFactory
D. @PersistenceUnit
E. .PersistenceContext

Answer: D
QUESTION: 38
Given this code snippet from a JMS message-driven bean class X:

11.
public XQ { System, out. print(“1 “); }

12.
public void onMessagefMessage m) throws Java. rmi. RemoteException

13.
try {

14.
TextMessage tm = (TextMessage) m;

15.
String text = tm.getText0;

16.
System, out. print(“2 “);

17.
} catch (JMSException e) {

18.
throw new java. rmi. RemoteExceptionQ; 19.}
20.}
When this bean class handles a message, which is correct?

A. After a messagedelivery theresultis1.

B. Aftera message delivery the resultis2.

C. Aftera message delivery the result is12.

D. Afteramessage delivery an exception isthrown.

E. After a message delivery the resultisunpredictable.

F. This isNOTanEJB3.0 compliant bean.

Answer: F
QUESTION: 39
Which statement is true about the primary key of a Java Persistence entity?

A. The primary key cannot be overriden by a mapping descriptor.
B. The location of the primary key defines the topmost entity class in the hierarchy.

C. If property-based  access is used, the  properties  of the  primary key class must be public or protected.
D. At least part of a primary key must be defined in the class that is the topmost class of an entity which is defined by a hierarchy of classes.

Answer: C
QUESTION: 40 A session bean calls the setRollbackOnly method on the EJBContext interface within a business method with an active transaction. Which two are correct? (Choose two.)
A. The transaction timeout is immediately disabled.
B. The container will ensure that the transaction will never commit.
C. The bean must have started the current transaction for this to be legal.
D. The bean must have bean-managed transaction demarcation for this to be legal.
E. Thebean must have container-managed transaction demarcation for this to be legal.

Answer: B, E
QUESTION: 41
Which statement about entity manager is true?

A. A container-managed entity manager must be a JTA entity manager.
B. An entity manager injected into session beans can use either JTA or resource-local transaction control.
C. An entity manager created by calling the EntityManagerFactory.createEntityManager method always uses JTA transaction control.
D. An entity manager obtained through resource injection in a stateful session bean can use a resource-local EntityTransaction for transaction control

Answer: A
QUESTION: 42
A Java Persistence application uses a Version attribute to manage concurrent updates.
Which is true?

A. The Version attribute must have a public access type.
B. The Version attribute is used by the persistence provider.
C. A separate Version  attribute  must be specified for each class in the inheritance hierarchy.
D. A separate Version column must be specified for each table mapped to the entity.

Answer: B
QUESTION: 43 A developer writes a stateful session bean FooBarBean with two local business interfaces Foo and Bar. The developer wants to write a business method called getBarfor interface Foo that returns a Bar reference to the same session bean identity on which the  client invokes getBar. Which  code, when inserted on Line 12 below, implements the getBar method with the wanted behavior? 10..Resource SessionContext sessionCtx;
11.
public BargetBarOJ

12.

13.}

A. return(Bar)this;

B. return(Bar) new FooBarBeanQ;

C. return (Bar) sessionCtx.lookup(“FooBarBean”)

D. return (Bar) sessionCtx.getBusinessObject(Bar.class);

E. InitialContextic= new InitialContextQ;
return (Bar) ic.lookup(“java:comp/env/ejb/FooBarBean”);

Answer: D
QUESTION: 44 Which statement about the combination of mapping defaults, annotations, and XML descriptors is correct?
A. All mapping annotations must always be processed by the persistence provider.
B. Some annotations, like the @Entity annotation, must always be processed by the persistence provider.
C. The mapping information for an entity class specified by annotations and in XML
descriptors must be distinct.

D. If multiple entity listeners are defined, the order in which they are invoked can be
defined or overwritten in the XML descriptor.

Answer: D
QUESTION: 45 A developer wants to release resources within a stateless session bean class. The cleanup method should be executed by  the container before an instance of  the class is removed. The deployment descriptor is NOT used. Which three statements are correct? (Choose three.)
A. The cleanup method may declare checked exceptions.
B. The cleanupmethodmusthave noarguments andreturn void.
C. The cleanup method isexecuted inan unspecifiedtransactionand security context.
D. The developer should mark the cleanup methodwiththe @PreDestroy annotation.
E. The developershouldmark thecleanupmethodwiththe @PostDestroy annotation.
F. Thecleanup method  is executed inthetransactionandsecurity context ofthelast business method invocation.

Answer: B, C, D
QUESTION: 46
Given code snippets from two files:

7.
public class Dog {

8.
public void onMessage(Message m) { System, out. print(“1 “);

9.
1
And

10.
@MessageDriven

11.
class MessageDog extends Dog implements MessageDrivenBean

12.
MessageDog(Message m){ System, out. print(“2 “); }
13.}
Which four code changes, when used together, create a valid JMS message-driven bean?
(Choose four.

A. Make class MessageDog public.

B. Make the MessageDog constructor no-arg.

C. Make the MessageDog constructor public.

D. Move the onMessage method to class MessageDog.

E. Change MessageDog so that it is NOT a subclass of Dog.
F. Make class MessageDog implement MessageListener instead of MessageDrivenBean.
Answer: A, B, C, F
QUESTION: 47 A developer writes a stateless session bean FooBean with one remote business interface FooRemote containing one business method foo.  Method foo  takes a single parameter of application-defined type MyData.
11.
public class MyData implements Java. io.Serializablej

12.
int a; 13.}
Method foo is implemented within the FooBean class as:

11.
public void foo(MyData data) {

12.
data.a = 2; 13.}
Another session bean within the same application has a reference to FooRemote in
variable fooRef and calls method foo with the following code:

11.
MyData data = new MyDatafJ;

12.
data.a = 1;

13.
fooRef.foo(data);

14.
System, out. println(data. a);
What is the value of data, a when control reaches Line 14 of the client ?

A. 0

B. 1

C. 2

D. either1or 2

Answer: B
QUESTION: 48
EJB 3.0 containers must provide a specific subset of which two APIs? (Choose two.

A. JSP APIs
B. JavaMailAPIs
C. JAX-WS APIs
D. Java CardAPIs
E. Sun Studio APIs

Answer: B, C
QUESTION: 49
Given the following code in an EJB 3.0 session bean:

10.
@Resource(name=”jdbc/employeeDB”)

11.
private DataSource dataSource;

12.

13.
public void lookupEmployee(String id) {

14.
InitialContext ic = new InitialContextO;

15.
// insert code here

16.
DataSource ds = (DataSource) obj;
17.}
Which code, inserted at Line 15, portably looks up the injected resource?

A. Object obj = ic.lookup(“employeeDB”);

B. Object obj = ic.lookup(“dataSource”);

C. Object obj = ic.lookup(“jdbc/employeeDB”);

D. Object obj = ic.lookup(“javacomp/env/employeeDB”);

E. Object obj = ic.lookup(“java:comp/env/jdbc/employeeDB”);

Answer: E
QUESTION: 50 Which Java Persistence query uses the aggregate function correctly, assuming that chairs field is of type int?
A. SELECT ANY(r. chairs) FROM Room r
B. SELECT NEW Integer(MAX(r. chairs)) FROM Room r
C. SELECT r FROM Room r WHERE r.chairs > AVG(r.chairs)
D. SELECT c FROM Chair c WHERE LOCATE (c.type, lazyboy) > -1
Answer: B
QUESTION: 51

A session bean’s business method  throws  an exception during  execution.  Which two are responsibilities of the Bean Provider when throwing the exception? (Choose two.)
A. For application exceptions, ensure that if the current transaction commits there will be no loss of data integrity.
B. For application exceptions, ensurethatthe current transaction will commit.
C. For system errors, when the client is remote, throw a java.rmi.RemoteException that wraps the original exception.
D. For checked exceptions from which the bean cannot recover, throw an EJBException that wraps the original exception.

Answer: A, D
QUESTION: 52 A developer creates the following session bean: 10..Stateless
11.
@RolesAllowed(“SECRET”)

12.
public class MyBean implements Mylnterface {

13.
public void methodAOJ}

14.
@PermitAII

15.
public void methodB0 {}

16.
@DenyAII

17.
public void methodC0 {}

18.
} No deployment descriptor is supplied. Which two statements are true? (Choose two.)

A. Auserin the role “SECRET” will be able to accessallof the methods.
B. A user inthe role”FOO” will be able to accessmethodAandmethodB.
C. A user withoutanyrolewill beable to accessmethodBbut NOTmethodA.
D. A user in the role “SECRET”willbe able to accessmethodA andmethodB.
E. A userintherole “SYSADM” will be abletoaccessmethodA,methodB, and methodC.
Answer: C, D
QUESTION: 53

A developer wants to create a Java Persistence query to perform a bulk update operation on five different entity classes. All of these classes have a field called name. These classes have the following relationships: Harrier extends Dog and Dog extends Animal Vet extends Doctor What is the minimum possible number of operations required to change the value of the name field for all of the entities in all five classes?
A. 1
B. 2
C. 3
D. 4
E. 5
Answer: B

QUESTION: 54
A developer writes an enterprise application and packages it into an .ear file. The application contains two persistence  units defined at the .ear level with persistence unit names FooPU and BarPU. The application also contains an ejb-jar with one stateless session bean. Which code, when added to the stateless session bean class, injects an EntityManagerFactory at runtime?
A. PersistenceUnit private EntityManagerFactory emf; B. PersistenceContext private EntityManagerFactory emf;
C. PersistenceUnit(unitName=”BarPU”) private EntityManagerFactory emf;
D. Resource(name=”BarPU”, type=EntityManagerFactory.class) private EntityManagerFactory emf;

Answer: C
QUESTION: 55 A developer is working on a user registration  application using  EJB 3.0. A business method registerUser  in stateless session bean RegistrationBean  performs the user registration. The registerUser method executes in a transaction context started by the client. If some invalid user data causes the registration to fail, the client invokes

registerUser again with corrected data using the same transaction. Which design can
meet this requirement?
A. Have registerUser method call EJBContext.setRollbackOnlyOmethodafter registration fails.
B. Have registerUser method throw javax.ejb.EJBTransactionRequiredExceptionafterregistration fails.
C. HaveregisterUser method throw EJBException without marking the transaction for rollback, after registration fails.
D. Create an application exception withtherollbackattributeset to falseandhave registerUser method throwit afterregistration fails.

Answer: D
QUESTION: 56
Which statement is true about the Timer service in an EJB 3.0 stateless session bean?

A. The timeout callback method contains the business logic that handles the timeout event.
B. The timeout callback method must be declared as a business method in business interfaces.
C. The timeout callback method can throw application exceptions to report business logic failures.
D. A bean class can implement multiple timeout callback methods, each associated with a different timer.

Answer: A
QUESTION: 57 A developer wants to create a portable EJB 3.0 application that includes the following class definition for the Entity Account: 11..Entity
12.
@Entityl_isteners(com. acme.AlertMonitor. class)

13.
public class Account {

14.
// more code here

15.
@PrePersist

16.
protected void validateCreate0 {/* more code here */} 17.}

Which statement is correct?
A. The validateCreate method may NOT throwruntimeexceptions.
B. ThevalidateCreate method can invoke the EntityManager.flush operation.
C. Methods oftheclass com.acme.AlertMonitor annotatedwithcallback annotationsmusttake an Object or Account instance astheonly argument.
D. The above class  definition is NOT  correct. An entity cannot defineacallback methodlike PrePersistand use the EntityListeners annotationatthe same time.

Answer: C
QUESTION: 58
Given this code snippet from a JMS message-driven bean class X:

11.
public XQ { System, out. print(“1 “); }

12.
public void onMessagefMessage m) throws Java. rmi. RemoteException

13.
try {

14.
TextMessage tm = (TextMessage) m;

15.
String text = tm.getText0;

16.
System, out. print(“2 “);

17.
} catch (JMSException e) {

18.
throw new java. rmi. RemoteExceptionQ;
19.}
20.}
When this bean class handles a message, which is correct?

A. After a messagedelivery theresultis1.

B. Aftera message delivery the resultis2.

C. Aftera message delivery the result is12.

D. Afteramessage delivery an exception isthrown.

E. After a message delivery the resultisunpredictable.

F. This isNOTanEJB3.0 compliant bean.

Answer: F
QUESTION: 59 FooBean is an EJB 3.0 session bean that can make valid use of UserTransaction. Which is guaranteed to work in an EJB container for FooBean to obtain the UserTransaclion object?

A. Invoke a method on a SessionContext that returns a UserTransaction object.
B. Perform JNDI lookup with name “java:/UserTransaction” on an InitialContext.
C. Perform JNDI lookup with the name “jdbc/UserTransaction” on an InitialContext.
D. Use the @TransactionManagement annotation to inject an instance variable of type UserTransaction in a bean class.

Answer: A
QUESTION: 60
An Application Assembler is given the following stateless session bean:
10..Stateless public class MyBean implements Mylnt {

11.
@RolesAllowed(“SECRET”)

12.
public void methodA(int x) {}

13.
public void methodA(String y) {}

14.
public void methodB(String z) {}

15.
}
A deployment descriptor is also supplied, a portion of which reads as follows:

20.
<method-permission>

CCNA Exam Certification Guide is a best-of-breed Oracle 1Z0-860 exam study guide that has been completely updated to focus specifically on the objectives.Senior instructor and best-selling author Wendell Odom shares preparation hints and Oracle 1Z0-860 tips to help you identify areas of weakness and improve both your conceptual and hands-on knowledge.Oracle 1Z0-860 Material is presented in a concise manner,focusing on increasing your understanding and retention of exam topics.