Changes for page Best Practices-Model

Last modified by Theodore Petrosky on 2014/02/20 18:51

From version 21.1
edited by arroz
on 2007/12/20 11:12
Change comment: There is no comment for this version
To version 24.1
edited by arroz
on 2007/12/20 11:33
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -4,8 +4,22 @@
4 4  
5 5  {{/warning}}
6 6  
7 -prototypes
7 += Model =
8 8  
9 +One of the greatest things about WebObjects is the Enterprise Objects Framework (EOF) that handles all your data management. More than 10 years old, it's still one of the most powerful OR mapping tools available, if not the most powerful. It even inspired Code Data, an EOF clone used in the Mac desktop for all the data handling an application needs, introduced in Mac OS X Tiger (10.4).
10 +
11 +One great feature of EOF is data modeling. EOF allows you to define your data model in one or more Model files that are contain all the information needed by the application to, in run time, access the database to create, search and delete your data. Here we'll see some useful advices about data modeling and Model file creation.
12 +
13 +== Prototypes ==
14 +
15 +EOF is a great tool, and one good thing about it is that it doesn't try to hide or make decisions for you. Enterprise applications is serious stuff, and many factors, like backward compatibility with existing databases must be taken care. One place where EOF leaves the decision to you is how it should map your Java objects to the database internal data types.
16 +
17 +There are two main reasons for this:
18 +
19 +* There are some things EOF simply can't guess. If you have a String, you need to decide how much space you want to use on the database for it. If you know the String will contain a color, like "Red" or "Yellow", something like a varchar 50 should be enough. On the other end, if the String will be used to store a full name of a user, you probably want to make it a varchar 1000 or so (European names can be very long!). Of course, most databases allow you to use unlimited text data types, but that has serious implications in the database speed. So, it's up to you.
20 +
21 +* You may be constrained to existing data types. If you are building an WO application on top of an existing database with millions of records, you cannot choose the data types you want to use - you must use the existing ones used by the database. So, you have to tell EOF what types are those, so that it can read and write information to your existing database.
22 +
9 9  eogenerator
10 10  
11 11  to-many relationships