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