Helma Logo
main list history
previous version  overview  next version

Version 12 by Philipp on 04. June 2008, 18:44

To store your HopObjects into a relational database system you need to define a database mapping. This is done in the type.properties files located in the persistent  HopObject's prototype directory (e.g. apps/myApp/MyPrototype). The type.properties files contain no JDBC connection information, which is located in the db.properties file in the Helma installation directory.

=== Configuration Settings ===

_db = datasourceName

The _db entry describes the database source to use for managing objects of this type. datasourcename is the connection's name defined in the db.properties, which is located in Helma’s installation directory or the application directory. The db.properties file contains information about the JDBC connections, like the JDBC driver, the connection URL and the database username and password.

_table = tableName

The _table entry tells Helma which table to use for objects of this type within the database. To avoid problems with reserved words of SQL or your database system you should prefix your table names. (e.g. T_Story for the Story prototype’s table)

_extends = Prototype

The _extends entry engages Helma to inherit properties, functions and skins from another prototype. This can be compared to Java’s subclassing mechanism.

For example could be a Dog's _extends value the Animal, which inherits to the Dog prototype basic properties like father or mother, some skins and standard functions like getBiologicalClassification()


_parent = localPropertyName, localProperty.parentsCollectionName, root.collectionName

The _parent entry contains a comma-separated list of properties of objects of this type to be used as parent. Objects must know their parent in order to generate correct URLs in their href() function. If a property in the list is null, Helma will look on the following one to fetch a parent object.

If an entry in the _parent item does not contain a dot, it is interpreted as an object property of the current object that acts as the object's parent. If an entry contains a dot character, the part after the dot is interpreted as a collection in the parent object in which the current object is contained. If the _parent is specified as "root", it is not interpreted as a property of the current object. Instead, the application's root object is used as parent object.

_id = primaryKeyColumnName

The _id entry defines the column to use as primary key. Helma requires a single primary key with no other functionality.


=== Simple Properties ===

simplePropertyName = DB_COLUMN_NAME

A simple property maps a property name of the object to a column of the database table. The type of the table's column need not be specified. Helma does all necessary conversion when reading or writing a property value.

simplePropertyName.readonly = true

Makes the property read only and initializes it with the value from the database.

simplePropertyName.private = true

The private flag forces Helma to update this column only in the database, but prevents any updates on collections and references containing the modified object.

=== Referenced Objects ===
obj = object(SomeHopObject)





=== Collections ===

coll = collection(SomeHopObject)














=== Mountpoints ===

moutpointName = mountpoint(SomeTransientHopObject)