Quick links: Content - sections - sub sections
EN

Trace: 1.5.x 1.6 modules 1.7 1.1 1.6.x 1.1.x erreurs-1.1 1.0 using-dao

This is an old revision of the document!


How to use daos

Jelix proposes a relational object-mapping system named jDao, based on DAO pattern.

The DAO pattern is based on two types of objects : a “record” object, container of the data, and a factory object, which makes it possible to retrieve lists of records, or to create, save, erase records, too.

Concretely with jDao, a DAO XML file enables you to define a record and a factory, which will act on one or more tables at the same time. You thus define the mapping in it: which field of the table will go in which property of the record, as well as the type of data, the keys, on which tables the mapping is carried out, according to which joints etc.

Starting from this file, jDao dynamically generates two classes based respectively on jDaoRecordBase and jDaoFactoryBase (which is stored in a php file in the cache of jelix), in which all main methods and SQL requests are statically provided. Indeed, in contrary to other mapping systems, SQL requests are thus generated only once, and not dynamically with each page calls That allows better performances.

In the DAO XML file, you can also define your own access methods to data, and jDao will generate the corresponding methods and requests in the DAO factory.

en/tutorial/using-dao.1168723691.txt.gz · Last modified: 2007/01/15 09:44 (external edit)

Recent changes RSS feed Creative Commons License