MiG InfoCom MiG Calendar DBConnect Guide User Manual

Page 12

Advertising
background image

MiG InfoCom AB

query.

To create the mapping use:

new ActivityAffectedMapping(...)

DateRange – This is the normal date range that the activity spans. In
case of a recurrent activity this is the base date range. The database
column must be a string that can hold at least 64 characters.

To create the mapping use:

new DateRangeMapping(...)

Recurrence – If the activity is recurrent this is where the definition is
stored. The value is an XML text which has a length proportional to
the complexity of the recurrence. Since recurrence rules can be
combined into very complex recurrence rules with MiG Calendar there
is no upper limit to how long the text string can be. Normally about a
hundred characters. But none if the activity is not recurrent.

To create the mapping use:

new XMLDelegateMapping(...)

Categories – There are two ways to persist which categories the
activity is “member of”. One where a comma separated string
representation of the connected category id:s is stored as a value and
one where a separate many-to-many table connects activity id:s to
category id:s. The former is simpler and faster, the latter is more
database correct and more flexible in some cases.

The single column approach is created like any other property
mapping. You will have to provide the class type that the category id
has and a delimiter (e.g. a comma sign) that is guaranteed not to be in
the string representation of the id itself. The class type that is used as
the id for the categories must have a constructor that takes a single

String

argument. For instance

String

,

Integer

and

Long

has

this already. The column type in the database must be string of a
length that can hold as many characters as there will be category id:s
for a single activity expressed as a comma separated string.

To create the mapping with this approach use:

new StringArrayMapping(...)

The id-to-many join table mapping approach is from a database
design perspective the better choice since it avoids having references
to other entities in a composite database column. There are no special
demands on the object used as category id other that it must be able
to be mapped to a singe column.

DBConnect Guide

Page 12 / 25

Advertising