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