Debian Codegraph @

docs/collections/tutorial/tutorialintroduction.html

raw
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>Tutorial Introduction</title>
7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB Collections Tutorial" />
10 <link rel="up" href="intro.html" title="Chapter 1.  Introduction" />
11 <link rel="prev" href="developing.html" title="Developing a DB Collections Application" />
12 <link rel="next" href="BasicProgram.html" title="Chapter 2.  The Basic Program" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">Tutorial Introduction</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="developing.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 1. 
26 Introduction
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="BasicProgram.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="tutorialintroduction"></a>Tutorial Introduction</h2>
38 </div>
39 </div>
40 </div>
41 <p>
42 Most of the remainder of this document illustrates the use of the
43 DB Java Collections API by presenting a tutorial that describes usage of the API.
44 This tutorial builds a shipment database, a familiar example from classic
45 database texts.
46 </p>
47 <p>
48 The examples illustrate the following concepts of the DB Java Collections API:
49 </p>
50 <div class="itemizedlist">
51 <ul type="disc">
52 <li>
53 <p>
54 Object-to-data <span class="emphasis"><em>bindings</em></span>
55 </p>
56 </li>
57 <li>
58 <p>
59 The database <span class="emphasis"><em>environment</em></span>
60 </p>
61 </li>
62 <li>
63 <p>
64 <span class="emphasis"><em>Databases</em></span> that contain key/value records
65 </p>
66 </li>
67 <li>
68 <p>
69 <span class="emphasis"><em>Secondary index</em></span> databases that contain index keys
70 </p>
71 </li>
72 <li>
73 <p>
74 Java <span class="emphasis"><em>collections</em></span> for accessing databases and
75 indices
76 </p>
77 </li>
78 <li>
79 <p>
80 <span class="emphasis"><em>Transactions</em></span> used to commit or undo database
81 changes
82 </p>
83 </li>
84 </ul>
85 </div>
86 <p>
87 The examples build on each other, but at the same time the
88 source code for each example stands alone.
89 </p>
90 <div class="itemizedlist">
91 <ul type="disc">
92 <li>
93 <p>
94 <a class="xref" href="BasicProgram.html" title="Chapter 2.  The Basic Program">
95 The Basic Program
96 </a>
97 </p>
98 </li>
99 <li>
100 <p>
101 <a class="xref" href="UsingSecondaries.html" title="Chapter 3.  Using Secondary Indices">
102 Using Secondary Indices
103 </a>
104 </p>
105 </li>
106 <li>
107 <p>
108 <a class="xref" href="Entity.html" title="Chapter 4.  Using Entity Classes">
109 Using Entity Classes
110 </a>
111 </p>
112 </li>
113 <li>
114 <p>
115 <a class="xref" href="Tuple.html" title="Chapter 5.  Using Tuples">
116 Using Tuples
117 </a>
118 </p>
119 </li>
120 <li>
121 <p>
122 <a class="xref" href="SerializableEntity.html" title="Chapter 6.  Using Serializable Entities">
123 Using Serializable Entities
124 </a>
125 </p>
126 </li>
127 </ul>
128 </div>
129 <p>
130 The shipment database consists of three database stores: the
131 part store, the supplier store, and the shipment store. Each store
132 contains a number of records, and each record consists of a key and
133 a value.
134 </p>
135 <div class="informaltable">
136 <table border="1" width="80%">
137 <colgroup>
138 <col />
139 <col />
140 <col />
141 </colgroup>
142 <thead>
143 <tr>
144 <th>Store</th>
145 <th>Key</th>
146 <th>Value</th>
147 </tr>
148 </thead>
149 <tbody>
150 <tr>
151 <td>Part</td>
152 <td>Part Number</td>
153 <td>Name, Color, Weight, City</td>
154 </tr>
155 <tr>
156 <td>Supplier</td>
157 <td>Supplier Number</td>
158 <td>Name, Status, City</td>
159 </tr>
160 <tr>
161 <td>Shipment</td>
162 <td>Part Number, Supplier Number</td>
163 <td>Quantity</td>
164 </tr>
165 </tbody>
166 </table>
167 </div>
168 <p>
169 In the example programs, Java classes containing the fields
170 above are defined for the key and value of each store:
171 <code class="classname">PartKey</code>,
172 <code class="classname">PartData</code>,
173 <code class="classname">SupplierKey</code>,
174 <code class="classname">SupplierData</code>,
175 <code class="classname">ShipmentKey</code> and <code class="classname">ShipmentData</code>. In
176 addition, because the Part's Weight field is itself composed of two
177 fields — the weight value and the unit of measure — it is
178 represented by a separate <code class="classname">Weight</code> class. These classes will
179 be defined in the first example program.
180 </p>
181 <p>
182 In general the DB Java Collections API uses bindings to
183 describe how Java objects are stored. A binding defines the stored
184 data syntax and the mapping between a Java object and the stored
185 data. The example programs show how to create different types of
186 bindings, and explains the characteristics of each type.
187 </p>
188 <p>
189 The following tables show the record values that are used in
190 all the example programs in the tutorial.
191 <span>
192
193 </span>
194 </p>
195 <div class="informaltable">
196 <table border="1" width="80%">
197 <colgroup>
198 <col />
199 <col />
200 <col />
201 <col />
202 <col />
203 </colgroup>
204 <thead>
205 <tr>
206 <th>Number</th>
207 <th>Name</th>
208 <th>Color</th>
209 <th>Weight</th>
210 <th>City</th>
211 </tr>
212 </thead>
213 <tbody>
214 <tr>
215 <td>P1</td>
216 <td>Nut</td>
217 <td>Red</td>
218 <td>12.0 grams</td>
219 <td>London</td>
220 </tr>
221 <tr>
222 <td>P2</td>
223 <td>Bolt</td>
224 <td>Green</td>
225 <td>17.0 grams</td>
226 <td>Paris</td>
227 </tr>
228 <tr>
229 <td>P3</td>
230 <td>Screw</td>
231 <td>Blue</td>
232 <td>17.0 grams</td>
233 <td>Rome</td>
234 </tr>
235 <tr>
236 <td>P4</td>
237 <td>Screw</td>
238 <td>Red</td>
239 <td>14.0 grams</td>
240 <td>London</td>
241 </tr>
242 <tr>
243 <td>P5</td>
244 <td>Cam</td>
245 <td>Blue</td>
246 <td>12.0 grams</td>
247 <td>Paris</td>
248 </tr>
249 <tr>
250 <td>P6</td>
251 <td>Cog</td>
252 <td>Red</td>
253 <td>19.0 grams</td>
254 <td>London</td>
255 </tr>
256 </tbody>
257 </table>
258 </div>
259 <div class="informaltable">
260 <table border="1" width="80%">
261 <colgroup>
262 <col />
263 <col />
264 <col />
265 <col />
266 </colgroup>
267 <thead>
268 <tr>
269 <th>Number</th>
270 <th>Name</th>
271 <th>Status</th>
272 <th>City</th>
273 </tr>
274 </thead>
275 <tbody>
276 <tr>
277 <td>S1</td>
278 <td>Smith</td>
279 <td>20</td>
280 <td>London</td>
281 </tr>
282 <tr>
283 <td>S2</td>
284 <td>Jones</td>
285 <td>10</td>
286 <td>Paris</td>
287 </tr>
288 <tr>
289 <td>S3</td>
290 <td>Blake</td>
291 <td>30</td>
292 <td>Paris</td>
293 </tr>
294 <tr>
295 <td>S4</td>
296 <td>Clark</td>
297 <td>20</td>
298 <td>London</td>
299 </tr>
300 <tr>
301 <td>S5</td>
302 <td>Adams</td>
303 <td>30</td>
304 <td>Athens</td>
305 </tr>
306 </tbody>
307 </table>
308 </div>
309 <div class="informaltable">
310 <table border="1" width="80%">
311 <colgroup>
312 <col />
313 <col />
314 <col />
315 </colgroup>
316 <thead>
317 <tr>
318 <th>Part Number</th>
319 <th>Supplier Number</th>
320 <th>Quantity</th>
321 </tr>
322 </thead>
323 <tbody>
324 <tr>
325 <td>P1</td>
326 <td>S1</td>
327 <td>300</td>
328 </tr>
329 <tr>
330 <td>P1</td>
331 <td>S2</td>
332 <td>300</td>
333 </tr>
334 <tr>
335 <td>P2</td>
336 <td>S1</td>
337 <td>200</td>
338 </tr>
339 <tr>
340 <td>P2</td>
341 <td>S2</td>
342 <td>400</td>
343 </tr>
344 <tr>
345 <td>P2</td>
346 <td>S3</td>
347 <td>200</td>
348 </tr>
349 <tr>
350 <td>P2</td>
351 <td>S4</td>
352 <td>200</td>
353 </tr>
354 <tr>
355 <td>P3</td>
356 <td>S1</td>
357 <td>400</td>
358 </tr>
359 <tr>
360 <td>P4</td>
361 <td>S1</td>
362 <td>200</td>
363 </tr>
364 <tr>
365 <td>P4</td>
366 <td>S4</td>
367 <td>300</td>
368 </tr>
369 <tr>
370 <td>P5</td>
371 <td>S1</td>
372 <td>100</td>
373 </tr>
374 <tr>
375 <td>P5</td>
376 <td>S4</td>
377 <td>400</td>
378 </tr>
379 <tr>
380 <td>P6</td>
381 <td>S1</td>
382 <td>100</td>
383 </tr>
384 </tbody>
385 </table>
386 </div>
387 </div>
388 <div class="navfooter">
389 <hr />
390 <table width="100%" summary="Navigation footer">
391 <tr>
392 <td width="40%" align="left"><a accesskey="p" href="developing.html">Prev</a> </td>
393 <td width="20%" align="center">
394 <a accesskey="u" href="intro.html">Up</a>
395 </td>
396 <td width="40%" align="right"> <a accesskey="n" href="BasicProgram.html">Next</a></td>
397 </tr>
398 <tr>
399 <td width="40%" align="left" valign="top">Developing a DB Collections Application </td>
400 <td width="20%" align="center">
401 <a accesskey="h" href="index.html">Home</a>
402 </td>
403 <td width="40%" align="right" valign="top"> Chapter 2. 
404 The Basic Program
405 </td>
406 </tr>
407 </table>
408 </div>
409 </body>
410 </html>