There are two representations of the Type
System of the hybris Commerce Suite.
- There is a file-based representation that is spread across in the various items.xml files of the hybris Commerce Suite extensions. This representation is not actively used by the hybris Commerce Suite at runtime. You can modify this representation at any time by modifying the items.xml file of an extension. However, modifications of the items.xml files only take effect after an initialization or an update of the hybris Commerce Suite.
- The database of the hybris Commerce Suite also contains a representation of the type system. This representation is actually in use by the hybris Commerce Suite at runtime. The representation in use reflects the state the type system was in when the hybris Commerce Suite was last updated or initialized
Locking the hybris Suite
Hybris
Administration Console also allows you to lock the system against
initialization or update. While this lock is in effect, the hybris Commerce
Suite can neither be updated nor initialized. This lock therefore prevents loss
of data. Lock can be activated and deactivated both from theInitialization and the Update page of the hybris
Administration Console
Initialization
Initialization
drops existing type definitions from the database prior to rebuilding, so the
entire type system is created from scratch. So during an initialization, type
system definitions are created to match the type system definition in the
items.xml
files
Initializing
the hybris Commerce Suite
Access the Initialization Page
1.)Open the hybris Administration Console.
2.) Go to
the Platform tab and select Initialization option. The Initialization page now
displays.
Click
the Initialize button. This:
1.) Aborts all running cron
jobs
2.) Removes
all tables from the database schema. The DROP TABLE statement is used. This
removes not only hybris Commerce Suite data, but all data stored in the
database schema. Since hybris Commerce Suite version 5.1, during the
initialization process the system no longer removes all tables. Now it only
removes those tables that are declared in its current items.xml files. Old
tables - orphaned data - stay intact
The
init process prior to hybris Commerce Suite version 5.1 creates the type system
by iterating through all extension managers and calling their methods in this
order:
initializeRemoveObjects
initializeCreateTypes
initializeModifyTypes
initializeCreateObjects
3.) The
init process in hybris Commerce Suite 5.1 or later prepares the ddl and dml
scripts and executes them (unless dryrun is enabled, in which case the scripts
are not executed). This way - the schema is prepared and persisted into db. Ddl scripts also remove tables.
4.) Clears
cache and Creates a number of media folders
5.) Sets licenses
At this point the type system has been initialized.
The Initialization continues with creating essential data and project data
(This is optional, but enabled for all extensions by defautl). Furthermore,
during the init process the hmc configuration is cleared and types are
localized.
You can also initialize
the system from the command line by running the command
ant initialize.
Update
During
an update, type system definitions are modified to match the new type system
definition in the
items.xml
files.
First
and foremost, the update mechanism makes sure that all data that existed in the
system before the update is still accessible after the update.
Therefore:
1.)Update preserves the
table name, to which a type was mapped, even if it was changed in
items.xml
2.)Update preserves the
column name, to which an attribute was mapped, even if it was changed in
items.xml
3.)
Update preserves the
column type for an attribute, even if it was changed in items.xml
4.)Update does not drop any
tables and columns
5.)Update does not delete
any item data, including type instances and type system data (composed types
etc.)
6.)Update drops and
recreate indices, if they are added or changed in
items.xml
7.)Update
does NOT change the attribute from optional to mandatory, even if it was
changed in
items.xml
This is
what the process looks like:
- The
type system definitions from all extensions
items.xml
files are read in. - The
hybris Commerce Suite type system in the database is modified according to the
type definitions of all extensions
items.xml
files.
- Adding newly defined types to the type system definition in the database.Type definitions and attribute definitions that are not part of the type system definition in the database are added.
- Modifying existing types to match the type system definition in the database.Type definitions and attribute definitions that are changed compared to the type system definition in the database are modified.
- Again, like in the init process, the old update logic (prior to hybris Commerce Suite 5.1) iterates through extensions and uses extension manager methods to create and modify types. Whereas, in the new update (since hybris Commerce Suite 5.1), ddl and dml scripts are also generated here.
- Update then continues with creating essential and project data, optionally, if selected.
Nice post, good to see someone writing documentation and sharing it.
ReplyDeletebut want to ask, if lets say i am using hybris as my website. what happen if I initialize it.? will it wipe out all my data and website.?
it will wipe out all data.
ReplyDelete