Helma Logo
main list history

Collection Mapping

Naming conventions

All the tables and columns in the database are all lowercase. (Which is quite handy with an Mysql database because the names are case-sensitive if the underlying file system is also case-sensitive. So Mysql Names are case sensitive on Linux but not on Windows.)

Tablenames are plural.

Prototype names start with upper case and are camel case. Prototype names are singular.

Property- Object- and Collection-Mapping start with lower case and are also camel case.

Foreign keys are prefixed with the name of the table they are referring to.


1:n relation

DB schema


Mapping

Gallery/type.properties
   images         = Collection(Image)
   images.local   = gallery_id
   images.foreign = galleries_gallery_id

m:n relation

DB schema


Mapping

Image/type.properties
   tags                          = Collection(Tag)
   tags.filter                   = ${image_id} = tags2images.images_image_id AND \
                                   tags2images.tags_tag_id = tags.tag_id
   tags.filter.additionalTables  = tags2images

The Backslash "\" is only necessary when you have a filter that continues in the next line.

Comments

#1 by maks at 2008/05/09 05:09

While the above works well as a "view" for m:n mappings, it cannot currently be used as a normal collection, as Helma is Not able to add new objects to collections that have filters defined.

#2 by Philipp at 2009/12/16 23:30

The better* solution is a subscription-model: http://helma.org/wiki/Many-to-many+Relationships/

*) that's my opinion ;-)