Software Usage - Comprehensive Example Test Example JSP Javabean EJB ORACLE
1. Do a test example JSP JavaBean EJB Oracle. In order to display a row in Document_Master_Index. Operations such as display, modification, increase, delete. Note: This example is a training example that starts using J2EE in April 2001. The database is based on the Daming Oracle database, so if you talk to the document_master_index table, you can use any table.
2, EJB JBuilder5 quickly creates the Container Manager Entity Bean, corresponds to the document_master_index table. 1. Create an empty project StudeyDev and an empty EJB Group DMI. 2. Establish bean with EJB Entity Bean Modeler. Note: 1. JNDI Name in Step 2 of 7: If it is created, the type of Entity Bean is BMP, then you should fill in a name of a DataSource's JNDI configured in WebLogic. This DataSource is also associated with a pool; if the type of Entity Bean is CMP, the value here is not important, and it is important that the back Pool Name is. 2. You can specify a new class as a primary key in the primary key class in STEP 6 of 7. 3. Pool Name in Step 7 of 7: Use only for CMP, for BMP, meaningless. 3, compile EJB, produce dmi.jar. 4. This EJB can be configured by JB5 hot configuration or copy JAR file or configure this EJB with WebLogic. <2001-9-4 09:58 am 43 seconds>
3, JavaBean1, two in the javabean contact with EJB. 1. Global way to find JNDI, where the getInitialContext () method establishes a context with the specified URL. Context ctx = getInitialContext (); object ref = ctx.lookup ("jndi_documentmasterindex"); 2. Find JNDI through a mapping mechanism. In the application directory contains a web-inferon, this directory must contain web.xml, and may contain a WebLogic.xml file. In the previous method, these two files are not significant. If CONTEXT CTX = New InitialContext (); Object Ref = CTX.lookup ("Java: Comp / ENV / EJB / DMI"); this way is required to have corresponding code web.xml in web.xml and WebLogic.xml As follows: XML Version = "1.0" Encoding = "UTF-8"?>