cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Cayenne Documentation > Remote Object Persistence Tutorial Client Project
Date Wed, 06 Jan 2010 12:07:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAYDOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><s>Remote Object Persistence Tutorial Client Project</s></h2>
     <h4>Page <b>removed</b> by             <a href="http://cwiki.apache.org/confluence/display/~andrus">Andrus
Adamchik</a>
    </h4>
     <br/>
     <div class="notificationGreySide">
         
<h3><a name="RemoteObjectPersistenceTutorialClientProject-CreateaClientProject"></a>Create
a Client Project</h3>

<p><em>Creation of a new Eclipse project has been discussed in some details <a
href="/confluence/pages/createpage.action?spaceKey=CAYDOC&amp;title=Tutorial+Setup&amp;linkCreation=true&amp;fromPageId=10546"
class="createlink">here</a>, so we will omit the screenshots for the common parts.</em></p>

<ul>
	<li>In Eclipse go to <tt>"File &gt; New &gt; Project"</tt>. Select
a <tt>"Java Project"</tt> for the project type and click "Next".</li>
	<li>Enter <tt>"cayenne-tutorial-client"</tt> for the project name, select
"Create separate source and output folders" radio button and click "Next".</li>
	<li>On the next ("Java Settings") screen go to the "Libraries" tab and click "Add External
Jar" button on the right to add  the following .jar files needed by the client:
	<ul>
		<li><tt>cayenne-client-nodeps.jar</tt>, located in the "lib" directory
of the Cayenne installation.</li>
		<li><tt>hessian.jar</tt>, version 3.0.13, that can be downloaded from
<a href="http://www.caucho.com/hessian/" rel="nofollow">here</a>.</li>
		<li><tt>commons-logging.jar</tt>, version 1.0.4 or newer, that can be
downloaded from <a href="http://jakarta.apache.org/commons/logging/" rel="nofollow">here</a>.</li>
		<li><tt>commons-lang.jar</tt>, version 2.1 or newer, that can be downloaded
from <a href="http://jakarta.apache.org/commons/lang/" rel="nofollow">here</a>.</li>
		<li><tt>commons-collections.jar</tt>, version 3.1 or newer, that can be
downloaded from <a href="http://jakarta.apache.org/commons/collections/" rel="nofollow">here</a>:</li>
	</ul>
	</li>
</ul>


<p><img src="/confluence/download/attachments/10546/eclipse-client-libs.jpg" align="absmiddle"
border="0" /></p>

<ul>
	<li>When done click "Finish" and the new project should appear in Eclipse.</li>
</ul>


<h3><a name="RemoteObjectPersistenceTutorialClientProject-ClientClassGeneration"></a>Client
Class Generation</h3>

<p>Client classes are a lightweight version of server-side DataObjects. They are generated
using a separate template. Let's lace them in a new client project.</p>

<ul>
	<li><a href="/confluence/display/CAYDOC/Running+CayenneModeler" title="Running CayenneModeler">Start
CayenneModeler</a> and open <tt>"cayenne-tutorial/src/cayenne.xml"</tt>
file (note that the mapping files stay in the server project; client will obtain mapping information
from the server).</li>
	<li>Select an "UntitledDomainMap" DataMap and check "Allow Client Entities"</li>
	<li>Enter "cayenne.tutorial.client" for the "Client Java Package" and click an "Update.."
button next to it to refresh the client package of all entities.</li>
</ul>


<p><img src="/confluence/download/attachments/10546/client-package.jpg" align="absmiddle"
border="0" /></p>

<ul>
	<li>Now select "Tools &gt; Generate Classes" menu.</li>
	<li>For "Type" select "Client Persistent Objects" (this will use a different generation
template).</li>
	<li>For the output directory select "cayenne-tutorial-client/src" directory of your
<b>client</b> Eclipse project.</li>
	<li>Click "Generate".</li>
</ul>


<p><img src="/confluence/download/attachments/10546/client-class-generator.jpg" align="absmiddle"
border="0" /></p>

<p>Now go back to Eclipse, right click on "cayenne-tutorial-client" project and select
"Refresh" - you should see a pair of classes generated for each mapped entity. Note that you
should not modify the classes whose names start with "_" (underscore), as they will be replaced
on subsequent generator runs. Instead all custom logic should be placed in their subclasses
located in "cayenne.tutorial" package - those will never be overwritten by the class generator.</p>

<hr />
<p><b>Next Step: <a href="/confluence/pages/createpage.action?spaceKey=CAYDOC&amp;title=Remote+Object+Persistence+Tutorial+WebService&amp;linkCreation=true&amp;fromPageId=10546"
class="createlink">Remote Object Persistence Tutorial WebService</a></b></p>
<hr />
     </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message