Meaningless Drivel is fun!*
The moose likes Product and Other Certifications and the fly likes one question in ICE 287 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "one question in ICE 287" Watch "one question in ICE 287" New topic
Author

one question in ICE 287

Edy Yu
Ranch Hand

Joined: Nov 21, 2000
Posts: 264
24. While testing the create method of a CMP entity bean using the Universal Test Client of IBM WebSphere Studio Application Developer, the following exception is thrown: ... Exception: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] ... SQL0803N One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1" constrains table "LIBRARY.PATRON" from having duplicate rows for those columns. SQLSTATE=23505 Which of the following is the BEST place to set the breakpoint?
A. The ejbCreate method
B. The create method
C. The ejbPostCreate method
D. The ejbStore method

Select the best answer.
Can anybody give me answer to it and explain why?
Thanks in advance.


<i><br />Sun Certified Programmer for Java 2 Platform (SCJP)<br />Sun Certified Developer for Java 2 Platform (SCJD)<br />Sun Certified Web Component Developer for Java2 Platform, Enterprise Edition (SCWCD)<br />Sun Certified Business Component Developer for Java2 Platform, Enterprise Edition (SCBCD)<br />Sun Certified Enterprise Architect for J2EE (SCEA)<br />IBM Certified Enterprise Developer, WebSphere Studio V5.0<br /></i>
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
I think the answer is A.
Obviously, B is incorrect because the Entity Bean does not contain a create() method, since this is defined in the home interface, and when it is implemented in the bean, the ejb prefix will be added.
D is incorrect because the DB is complaining about the primary key violation. It will be correct, if the error is solely about saving the bean data, without any key issues.
In fact, choice A and C are quite similar, however, ejbPostCreate() is used to finish any actions that cannot be performed in ejbCreate() as the bean is not completely created at that moment. However, upon ejbCreate() is completed, the bean is created and the data is appear in the DB. Thus, if a data item cannot be inserted into the DB due to PK violation, problems should be appeared in ejbCreate().
Does this make sense?
Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Howard Kushner
author
Ranch Hand

Joined: Sep 19, 2003
Posts: 361
Originally posted by Nicholas Cheung:
I think the answer is A.
Obviously, B is incorrect because the Entity Bean does not contain a create() method, since this is defined in the home interface, and when it is implemented in the bean, the ejb prefix will be added.
D is incorrect because the DB is complaining about the primary key violation. It will be correct, if the error is solely about saving the bean data, without any key issues.
In fact, choice A and C are quite similar, however, ejbPostCreate() is used to finish any actions that cannot be performed in ejbCreate() as the bean is not completely created at that moment. However, upon ejbCreate() is completed, the bean is created and the data is appear in the DB. Thus, if a data item cannot be inserted into the DB due to PK violation, problems should be appeared in ejbCreate().
Does this make sense?
Nick

Makes sense to me!


Howard Kushner<br />IBM Certified Enterprise Developer - WebSphere Studio Application Developer V5.0<br />IBM Certified Advanced System Administrator - WebSphere Application Server V5.0<br />IBM Certified Solution Developer - Web Services with WebSphere Studio V5.1<br /><a href="http://www.amazon.com/exec/obidos/tg/detail/-/1931182108/" target="_blank" rel="nofollow">Developing J2EE Applications with WebSphere Studio</a> my Certification Study Guide for IBM Test 287
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: one question in ICE 287
 
Similar Threads
cmp UNIQUE KEY CONSTRATINT
Error Help
Synchronizing issue
IBM 287 questions to Howard
IBM 287 ICE TEST