MiG InfoCom MiG Calendar DBConnect Guide User Manual

Page 13

Advertising
background image

MiG InfoCom AB

The id-to-many join table is normally a simple table with two columns,
each holding an id to another object (activity/category). This way one
can express which categories belongs to which activities in a very
flexible manner. The disadvantage with this is that the retrieval of
these relations has to be done with a second query to the database,
which is slightly slower. The advantage is that the you can with an
SQL query directly for instance ask for “all activities that is connected
to a certain category”. This can't be done if the category id:s are
embedded in one column as in the singe column approach above.

To create the mapping with this approach create the appropriate

IDToManyPropertyMapping

objects and set them on the

PropertyMappingList

.

Last Modified – The last modified property should be represented as
a

Long

(bigint) in the database. To create the mapping with this

approach use:

new LastModifiedMapping(...)

Status – This is the status of the record. Currently there are only two
values.

0

or

null

means normal status and

1

means deleted. The

reason deleted records aren't simply removed from the database is
that if one user deletes it and another user's DBConnect detect its not
in the database it will re-create it rather than delete the local version.

The status is only exiting in the database and in the internals of
DBConnect. It will not be saved in the activity itself when loaded into
memory.

To create the mapping for this property use:

new StatusMapping(...)

Version – Every activity in the database is tagged with a version
number that is changed every time the activity is changed. This gives
DBConnect the possibility to update the database from more than one
source and still not lose information. The version is an

Integer

and

should be set to that type in the database. The version column can be
omitted to increase performance but if so the access to the database
must be single user (only one client).

The version is only exiting in the database and in the internals of
DBConnect. It will not be saved in the activity itself when loaded into
memory.

To create the mapping for this property use:

new VersionMapping(...)

DBConnect Guide

Page 13 / 25

Advertising