📄 package-summary.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Fri Dec 05 15:19:24 PST 2003 -->
<TITLE>
examples.ejb20.sequence.userDesignated (WebLogic Server 8.1 Examples)
</TITLE>
<META NAME="keywords" CONTENT="examples.ejb20.sequence.userDesignated package">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title="examples.ejb20.sequence.userDesignated (WebLogic Server 8.1 Examples)";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</td><td valign=bottom align=right><b>WebLogic Server 8.1 Code Examples</b>, BEA Systems, Inc.</td></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../examples/ejb20/relationships/bands/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../examples/i18n/simple/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" TARGET="_top"><B>NO FRAMES</B></A>
<SCRIPT>
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<H2>
Package examples.ejb20.sequence.userDesignated
</H2>
This example is a package that demonstrates the automatic primary key generation feature with an user-designated database.
<P>
<B>See:</B>
<BR>
<A HREF="#package_description"><B>Description</B></A>
<P>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Interface Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="Account.html"><I>Account</I></A></B></TD>
<TD>The methods in this interface are the public face of AccountBean.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="AccountHome.html"><I>AccountHome</I></A></B></TD>
<TD>This interface is the home interface for the EJBean AccountBean. </TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Class Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="AccountBean.html">AccountBean</A></B></TD>
<TD>AccountBean is an EntityBean. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="Client.html">Client</A></B></TD>
<TD>This class illustrates how to set up a CMP EJBean to
automatically generate the primary key upon insert.
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Exception Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="ProcessingErrorException.html">ProcessingErrorException</A></B></TD>
<TD>This class is used with the WebLogic EJBean container-managed example package.
</TD>
</TR>
</TABLE>
<P>
<A NAME="package_description"><!-- --></A><H2>
Package examples.ejb20.sequence.userDesignated Description
</H2>
<P>
<p>This example is a package that demonstrates the automatic primary key generation feature with an user-designated database.
The example is an entity EJBean called
<font face="Courier New" size=-1>AccountBean</font>.
<p>
The example demonstrates:
<ul>
<li>Use of an entity EJBean written to the EJB 2.0 specification
<li>Container-managed JDBC persistence; the code in the EJBean
never directly accesses the data storage
<li>Using WebLogic's automatic primary key generation feature
<li>Using application-defined exceptions
<li><a href="#Client">Client</a> application
</ul>
<h3>
Pre-Built Examples</h3>
<p>This EJB 2.0 example is not shipped pre-built. To run these examples, you must set up the persistent storage,
build the example following the instructions
in <a href="#Build the example">Build the example</a>, and then run the example following the instructions below.
<a name="Client"></a><h2>Client application</h2>
The Client
application performs these steps:
<ol>
<li>Creates two accounts with auto-generated primary keys.
<li>Displays the primary key after each account is created.
</ol>
<p>
To get the most out of this example, first read through the source
code files.
<ul>
<li>Client applications
<dd><a href="Client.java">Client.java</a>
<p>
<li>Interfaces
<dd><a href="Account.java">Account.java</a>
<dd><a href="AccountHome.java">AccountHome.java</a>
<p>
<li>Deployment
<dd><a href="ejb-jar.xml">ejb-jar.xml</a>
<dd><a href="weblogic-ejb-jar.xml">weblogic-ejb-jar.xml</a>
<dd><a href="weblogic-cmp-rdbms-jar.xml">weblogic-cmp-rdbms-jar.xml</a>
<p>
<li>Exception
<dd><a href="ProcessingErrorException.java">ProcessingErrorException.java</a>
<p>
<li> Server (EJBean)
<dd><a href="AccountBean.java">AccountBean.java</a>
</ul>
Take a look at the XML deployment files <a href="ejb-jar.xml">ejb-jar.xml</a>, <a href="weblogic-ejb-jar.xml">weblogic-ejb-jar.xml</a> and <a href="weblogic-cmp-rdbms-jar.xml">weblogic-cmp-rdbms-jar.xml</a> to find the general
structure of the EJBean, which classes are used for the different
objects and interfaces, then look at <a href="Client.java">Client</a> code to see how the application works.
<p>
These four sections cover what to do:
<p>
<ol>
<li><a href="#Set up the database">Set up the database</a>
<li><a href="#Build the example">Build the example</a>
<li><a href="#Start the Examples server">Start the Examples server</a>
<li><a href="#Run the example">Run the example</a>
</ol>
<h3><a name="Set up the database">Set up the database</a></h3>
<p>
Before you can run this example you must first configure it to work with a database which you use to create the required table and sequence. As you'll use a database for the persistent storage of the entity EJBean, you'll need to set it up. The persistent storage is completely invisible to the client; the actual storage is handled by the EJBean directly and not the container. With database persistence, each instance of an EJBean is written to a
row in a table.
<p>
This example allows you to designate the database you want to use for persistent storage. For your convience, you can set up either the PointBase or Oracle database for this example by enter one of the following commands:
<p>
<li>To use PointBase with this example:
<pre> prompt><b> ant db_setup_pointbase </b> </pre>
<li>To use Oracle with this example:
<pre> prompt><b> ant db_setup_oracle </b> </pre>
<p>
PointBase is supplied with the WebLogic Server dstribution. If you want or need to run this example with Oracle, see <a href=../../../database_setup.html>Database SetUp</a> for additioanl configuration instructions.
<h3><a name="Build the example">Build the example</a></h3>
Set up your development shell as described in
<a href=../../../examples.html#environment>Setting up your environment</a>.
<p>
We provide a build script for you to build the example:
<p>The build script is <b><a href="build.xml">build.xml</a></b>.
<p>Change to the <i>SAMPLES_HOME</i>\server\examples\src\examples\ejb20\sequence\userDesignated directory.</p>
<p>Run the build script using the following Java ant command:
<pre>prompt><b> ant</b></pre>
<p>
The script will build the example and place the files in the
correct locations in your WebLogic Server distribution:
<ul>
<li>Client.jar file: in <font face="Courier New" size=-1>SAMPLES_HOME\server\examples\build\clientclasses</font>
<li>EJB (in ear file): in <font face="Courier New" size=-1>SAMPLES_HOME\domains\examples\applications\ejb20_sequence_userDesignated.ear</font>
</ul>
<p>
Running the build script places the EJB in the <font face="Courier New"
size=-1>%applications%</font> directory, where it automatically
deploys once the server is started. If you are already running the server and build
another EJB, it is automatically placed in this directory and instantly deployed.
<p>
Additional information on using the build scripts
is found in
<a href="../../../examples.html#buildScripts">More About Building Examples</a>.
<h3><a name="Start the Examples server">Start the Examples server</a></h3>
<ol>
<li><a href=../../../examples.html#startServer>Start the Examples server</a>.
<p>
<li><a href=../../../examples.html#console >
Start the Administration Console.</a>
<p>
<li>Click the Deployments node in the left pane and select EJB Modules for standalone EJBs or Applications for EJBs
deployed as part of an application.
<p>
A list of deployed EJBs displays in the left pane.
<p>
<li>Choose the EJB JAR or EAR that you want to deploy from the list of deployment units.
<p>
<li>Select the Targets tab in the right pane.
<p>
<li> Verify that the EJB is deployed on the examplesServer. The examplesServer's box should be checked.
</li>
<p>
<li>Set up a connection pool via the Administration Console. See
<a href="http://e-docs.bea.com/wls/docs81/ConsoleHelp/jdbc_connection_pools.html "> "JDBC Connection Pools"</a> in the Administration Console
online help.
</ol>
<h3><a name="Run the example"></a>Run the example</h3>
<ol>
<p>
<li>Run the client in a separate command line window. Set up your client as described in
<a href=../../../examples.html#environment>Setting up your environment</a>,
and then run the client by entering:
<pre><font face="Courier New">prompt><b> java examples.ejb20.sequence.userDesignated.Client</b></font></pre>
<p>
If you're not running the WebLogic Server with its default settings,
you will have to run the client using:
<pre> prompt><b> ant run </b> </pre>
<p>
<li>You should receive output similar to this:
<pre><font face="Courier New">
Beginning sequence.userDesignated.Client...
Starting example...
Creating account with a balance of 30000.0 account type Savings...
Account successfully created
just created Account with auto-generated primary key 1
Creating account with a balance of 1000.0 account type Checking...
Account successfully created
just created Account with auto-generated primary key 2
End example...
End sequence.userDesignated.Client...
</font></pre>
</ol>
<h2>There's more...</h2
<p>
Read more about:
<ul>
<li>EJB in the
<a href="http://e-docs.bea.com/wls/docs81/ejb/index.html">BEA WebLogic Server Enterprise Java Beans</a>
</ul>
<P>
<P>
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</td><td valign=bottom align=right>Documentation is available at<br> <a href=http://e-docs.bea.com/wls/docs81>http://e-docs.bea.com/wls/docs81</a></td></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../examples/ejb20/relationships/bands/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../examples/i18n/simple/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" TARGET="_top"><B>NO FRAMES</B></A>
<SCRIPT>
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<a href=http://e-docs.bea.com/wls/docs81/copyright.html>Copyright</a> © 2003 BEA Systems, Inc. All Rights Reserved.
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -