|
by Keld H. Hansen
Preface
Keld continues to shed light on Castor-JDO. This month we look
at how Castor, an open-source project, helps to keep our Java
object model consistent.
Looking Back
In my
first article about Castor-JDO I showed you how to install
Castor (and the MySQL database system), how to setup the xml-
files that describe the database system that will be used, and
the mappings between the fields in the database tables and the
Java-properties in the beans. I also presented a couple of small
programs that could insert data with relations into the
database.
One observation we saw when we retrieved an object from the
database was, that Castor automatically fetches all related
objects. This is not always what we want since it might have a
negative impact on performance. This time we'll take at look at
what "lazy loading" can do for us.
The Test Case
Let me briefly introduce you to our test setup used in the first
article.
Consider a collection of movies. Each is either in VHS or DVD
format. For every movie we also register the actors. This gives
us a small test case, but it still contains the common relations
between entities: one-to-many and many-to-many:
There are two media types in the database: DVD and VHS. We also
have two movies and three actors:
|
Movie title |
Media |
Actors |
|
The Matrix |
DVD |
Keanu Reeves Laurence Fishburne |
|
Chain Reaction |
VHS |
Keanu Reeves |
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|