⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ebank2.html

📁 j2eePDF格式的电子书
💻 HTML
📖 第 1 页 / 共 2 页
字号:
    <th><a name="wp79823"> </a><div class="pCellHeading">Description</div></th></tr>  <tr align="left">    <td><a name="wp79825"> </a><div class="pCellBody"><code class="cCode">AccountDetails</code></div></td>    <td><a name="wp79827"> </a><div class="pCellBody">Encapsulates the state of an <code class="cCode">AccountBean</code> instance. Returned by the <code class="cCode">getDetails</code> methods of <code class="cCode">AccountControllerBean</code> and <code class="cCode">AccountBean</code>.</div></td></tr>  <tr align="left">    <td><a name="wp79829"> </a><div class="pCellBody"><code class="cCode">CodedNames</code></div></td>    <td><a name="wp79831"> </a><div class="pCellBody">Defines the strings that are the logical names in the calls of the <code class="cCode">lookup</code> method. (For example: <code class="cCode">java:comp/env/ejb/account</code>). The <code class="cCode">EJBGetter</code> class references these strings.</div></td></tr>  <tr align="left">    <td><a name="wp79833"> </a><div class="pCellBody"><code class="cCode">CustomerDetails</code></div></td>    <td><a name="wp79835"> </a><div class="pCellBody">Encapsulates the state of a <code class="cCode">CustomerBean</code> instance. Returned by the <code class="cCode">getDetails</code> methods of <code class="cCode">CustomerControllerBean</code> and <code class="cCode">CustomerBean</code>.</div></td></tr>  <tr align="left">    <td><a name="wp79837"> </a><div class="pCellBody"><code class="cCode">DBHelper</code></div></td>    <td><a name="wp79839"> </a><div class="pCellBody">Provides methods that generate the next primary keys (for example, <code class="cCode">getNextAccountId</code>).</div></td></tr>  <tr align="left">    <td><a name="wp79841"> </a><div class="pCellBody"><code class="cCode">Debug</code></div></td>    <td><a name="wp79843"> </a><div class="pCellBody">Has simple methods for printing a debugging message from an enterprise bean. These messages appear on the standard output of the J2EE 1.4 Application Server when it's run with the <code class="cCode">--verbose</code> option and in the server log.</div></td></tr>  <tr align="left">    <td><a name="wp79845"> </a><div class="pCellBody"><code class="cCode">DomainUtil</code></div></td>    <td><a name="wp79847"> </a><div class="pCellBody">Contains validation methods: <code class="cCode">getAccountTypes</code>, <code class="cCode">checkAccountType</code>, and <code class="cCode">isCreditAccount</code>.</div></td></tr>  <tr align="left">    <td><a name="wp79849"> </a><div class="pCellBody"><code class="cCode">EJBGetter</code></div></td>    <td><a name="wp79851"> </a><div class="pCellBody">Has methods that locate (by invoking <code class="cCode">lookup</code>) and return home interfaces (for example, <code class="cCode">getAccountControllerHome</code>).</div></td></tr>  <tr align="left">    <td><a name="wp79853"> </a><div class="pCellBody"><code class="cCode">TxDetails</code></div></td>    <td><a name="wp79855"> </a><div class="pCellBody">Encapsulates the state of a <code class="cCode">TxBean</code> instance. Returned by the <code class="cCode">getDetails</code> methods of <code class="cCode">TxControllerBean</code> and <code class="cCode">TxBean</code>.</div></td></tr></table></div><p class="pBody"></p><a name="wp79857"> </a><h3 class="pHeading2">Database Tables</h3><a name="wp79859"> </a><p class="pBody">A database table of the Duke's Bank application may be categorized by its purpose: representing business entities and holding the next primary key.</p><a name="wp79860"> </a><h4 class="pHeading3">Tables Representing Business Entities</h4><a name="wp79864"> </a><p class="pBody"><a  href="Ebank2.html#wp79870">Figure&nbsp;32-4</a> shows relationships between the database tables. The <code class="cCode">customer</code> and <code class="cCode">account</code> tables have a many-to-many relationship: A customer may have several bank accounts, and each account may be owned by more than one customer. This many-to-many relationship is implemented by the cross-reference table named <code class="cCode">customer_account_xref</code>. The <code class="cCode">account</code> and <code class="cCode">tx</code> tables have a one-to-many relationship: A bank account may have many transactions, but each transaction refers to a single account.</p><a name="wp79868"> </a><p class="pBody"></p><div align="left"><img src="images/Fig403.gif" height="260" width="418" alt="Duke's Bank Database Tables" border="0" hspace="0" vspace="0"/></div><p class="pBody"></p><p>  <a name="79870"> </a><strong><font >Figure&nbsp;32-4   Database Tables</font></strong></p><a name="wp79874"> </a><p class="pBody"><a  href="Ebank2.html#wp79870">Figure&nbsp;32-4</a> makes use of several abbreviations. PK stands for primary key, the value that uniquely identifies a row in a table. FK is an abbreviation for foreign key, which is the primary key of the related table. Tx is short for transaction, such as a deposit or withdrawal.</p><a name="wp79875"> </a><h4 class="pHeading3">Tables That Hold the Next Primary Key</h4><a name="wp79876"> </a><p class="pBody">These tables have the following names:</p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp79877"> </a><div class="pSmartList1"><li><code class="cCode">next_account_id</code></li></div><a name="wp79878"> </a><div class="pSmartList1"><li><code class="cCode">next_customer_id</code></li></div><a name="wp79879"> </a><div class="pSmartList1"><li><code class="cCode">next_tx_id</code></li></div></ul></div><a name="wp79880"> </a><p class="pBody">Each of these tables has a single column named <code class="cCode">id</code>. The value of <code class="cCode">id</code> is the next primary key that is passed to the <code class="cCode">create</code> method of an entity bean. For example, before it creates a new <code class="cCode">AccountBean</code> entity bean, the <code class="cCode">AccountControllerBean</code> session bean must obtain a unique key by invoking the <code class="cCode">getNextAccountId</code> method of the <code class="cCode">DBHelper</code> class. The <code class="cCode">getNextAccountId</code> method reads the <code class="cCode">id</code> from the <code class="cCode">next_account_id</code> table, increments the <code class="cCode">id</code> value in the table, and then returns the <code class="cCode">id</code>.</p><a name="wp79881"> </a><h3 class="pHeading2">Protecting the Enterprise Beans</h3><a name="wp79883"> </a><p class="pBody">In the J2EE platform, you protect an enterprise bean by specifying the security roles that can access its methods. In the Duke's Bank application, you define two roles--<code class="cCode">bankCustomer</code> and <code class="cCode">bankAdmin</code>--because two categories of operations are defined by the enterprise beans.</p><a name="wp79888"> </a><p class="pBody">A user in the <code class="cCode">bankAdmin</code> role will be allowed to perform administrative functions: creating or removing an account, adding a customer to or removing a customer from an account, setting a credit line, and setting an initial balance. A user in the <code class="cCode">bankCustomer</code> role will be allowed to deposit, withdraw, transfer funds, make charges and payments, and list the account's transactions. Notice that there is no overlap in functions that users in either role can perform.</p><a name="wp79890"> </a><p class="pBody">Access to these functions is restricted to the appropriate role by setting method permissions on selected methods of the <code class="cCode">CustomerControllerBean</code>, <code class="cCode">AccountControllerBean</code>, and <code class="cCode">TxControllerBean</code> enterprise beans. For example, by allowing only users in the <code class="cCode">bankAdmin</code> role to access the <code class="cCode">createAccount</code> method in the <code class="cCode">AccountControllerBean</code> enterprise bean, you deny users in the <code class="cCode">bankCustomer</code> role or any other role permission to create bank accounts.</p>    </blockquote>   <img src="images/blueline.gif" width="550" height="8" ALIGN="BOTTOM" NATURALSIZEFLAG="3" ALT="Divider">    <table width="550" summary="layout" id="SummaryNotReq1">      <tr>	<td align="left" valign="center">	<font size="-1">	<a href="http://java.sun.com/j2ee/1.4/download.html#tutorial" target="_blank">Download</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/faq.html" target="_blank">FAQ</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/history.html" target="_blank">History</a>	</td>        <td align="center" valign="center"><a accesskey="p" href="Ebank.html"><img id="LongDescNotReq1" src="images/PrevArrow.gif" width="26" height="26" border="0" alt="Prev" /></a><a accesskey="c" href="J2EETutorialFront.html"><img id="LongDescNotReq1" src="images/UpArrow.gif" width="26" height="26" border="0" alt="Home" /></a><a accesskey="n" href="Ebank3.html"><img id="LongDescNotReq3" src="images/NextArrow.gif" width="26" height="26" border="0" alt="Next" /></a><a accesskey="i" href="J2EETutorialIX.html"></a>        </td>	<td align="right" valign="center">	<font size="-1">	<a href="http://java.sun.com/j2ee/1.4/docs/api/index.html" target="_blank">API</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/search.html" target="_blank">Search</a>	<br>	<a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/sendusmail.html" target="_blank">Feedback</a></font>	</font>	</td>      </tr>    </table>    <img src="images/blueline.gif" width="550" height="8" ALIGN="BOTTOM" NATURALSIZEFLAG="3" ALT="Divider"><p><font size="-1">All of the material in <em>The J2EE(TM) 1.4 Tutorial</em> is <a href="J2EETutorialFront2.html">copyright</a>-protected and may not be published in other workswithout express written permission from Sun Microsystems.</font>  </body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -