Skip to content
Snippets Groups Projects
Commit 0237e07f authored by Marius Dumitru Florea's avatar Marius Dumitru Florea
Browse files

Revert "XWIKI-13468: The query used by the Document Tree to get the nested...

Revert "XWIKI-13468: The query used by the Document Tree to get the nested child pages is very costly"
* Too much duplication. Better move the hierarchy mapping in a separate file.

This reverts commit da8a821d.

(cherry picked from commit a9adeb63)
parent d8d4c011
No related branches found
No related tags found
No related merge requests found
......@@ -434,130 +434,4 @@
<generator class="assigned" />
</id>
</class>
<!-- -->
<!-- Nested Pages Hierarchy -->
<!-- -->
<!-- When displaying the page hierarchy (e.g. using the tree widget) we need to get information from
both the documents table and the spaces table. Each of these tables contains some information that is
not found on the other. The documents table contains the terminal pages while the spaces table contains
the "empty" spaces (no direct terminal child pages). In order to get all the needed information we need
to perform a union or an outer join (between unrelated Hibernate entities). The Hibernate version we
use doesn't support either (HHH-1050 and HHH-16) so we define a new entity XWikiPage that is mapped to
a SQL query rather than to an existing table. The SQL query can be overwritten for specific databases
if needed. See XWIKI-13468. In the future we could merge the documents and spaces tables into a single
one (the pages table) -->
<class name="com.xpn.xwiki.internal.model.XWikiPage" mutable="false">
<subselect><![CDATA[
select XWS_REFERENCE as reference, false as terminal, XWS_NAME as name, XWS_PARENT as parent, XWS_HIDDEN as hidden
from xwikispace
union
select XWD_FULLNAME as reference, true as terminal, XWD_NAME as name, XWD_WEB as parent, XWD_HIDDEN as hidden
from xwikidoc
where XWD_TRANSLATION = 0 and XWD_NAME <> 'WebHome'
]]></subselect>
<synchronize table="xwikidoc" />
<synchronize table="xwikispace" />
<id column="id" type="long" unsaved-value="undefined" />
<properties name="pageId">
<property name="reference" type="string" length="255" index="PAGE_REFERENCE" not-null="true" access="field" />
<property name="terminal" type="boolean" length="255" index="PAGE_TERMINAL" not-null="true" access="field" />
</properties>
<property name="name" type="string" length="255" index="PAGE_NAME" not-null="true" access="field" />
<property name="parent" type="string" length="255" index="PAGE_PARENT" access="field" />
<property name="hidden" type="boolean" length="255" index="PAGE_HIDDEN" not-null="true" access="field" />
<!-- In order to sort the child XWikiPages by translated title (with fall-back on the default title,
see XWIKI-12832) we need to perform an outer join which is possible only between related entities thus
we aggregate the page translations here. -->
<set name="translations" lazy="true" cascade="none" access="field">
<key property-ref="pageId">
<column name="reference" />
<column name="terminal" />
</key>
<one-to-many class="com.xpn.xwiki.internal.model.XWikiPageTranslation" />
</set>
</class>
<!-- The XWikiPage translations, needed for sorting XWikiPages by their localized title. The pages
that correspond to "empty" spaces don't have associated translations. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageTranslation" mutable="false">
<subselect><![CDATA[
select case when XWD_NAME = 'WebHome' then XWD_WEB else XWD_FULLNAME end as reference,
case when XWD_NAME = 'WebHome' then false else true end as terminal,
nullif(XWD_TITLE, '') as title, XWD_LANGUAGE as locale, XWD_DEFAULT_LANGUAGE as defaultLocale
from xwikidoc
]]></subselect>
<synchronize table="xwikidoc" />
<id column="id" type="long" unsaved-value="undefined" />
<many-to-one name="page" property-ref="pageId" not-null="true" access="field">
<column name="reference" />
<column name="terminal" />
</many-to-one>
<property name="title" type="string" length="255" index="PAGE_TITLE" access="field" />
<property name="locale" type="string" index="PAGE_LOCALE" length="5" access="field" />
<property name="defaultLocale" type="string" index="PAGE_DEFAULT_LOCALE" length="5" access="field" />
</class>
<!-- -->
<!-- Nested Spaces Hierarchy -->
<!-- -->
<!-- This entity is used to represent the Nested Spaces hierarchy, which we don't use in practice
(we normally use the Nested Pages hierarchy instead) but the Document Tree has an option to display it
so we keep this entity for backward compatibility. Even though the page and the space entities are distinct
in this hierarchy, a space can have both page and space children so we still need to query them together
in order to support sort and pagination. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageOrSpace" mutable="false">
<subselect><![CDATA[
select XWS_REFERENCE as reference, false as terminal, XWS_NAME as name,
XWS_PARENT as parent, null as parentDoc, XWS_HIDDEN as hidden
from xwikispace
union
select XWD_FULLNAME as reference, true as terminal, XWD_NAME as name,
XWD_WEB as parent, XWD_PARENT as parentDoc, XWD_HIDDEN as hidden
from xwikidoc
where XWD_TRANSLATION = 0
]]></subselect>
<synchronize table="xwikidoc" />
<synchronize table="xwikispace" />
<id column="id" type="long" unsaved-value="undefined" />
<properties name="pageId">
<property name="reference" type="string" length="255" index="PAGE_REFERENCE" not-null="true" access="field" />
<property name="terminal" type="boolean" length="255" index="PAGE_TERMINAL" not-null="true" access="field" />
</properties>
<property name="name" type="string" length="255" index="PAGE_NAME" not-null="true" access="field" />
<property name="parent" type="string" length="255" index="PAGE_PARENT" access="field" />
<!-- This is needed in order to implement the deprecated Parent-Child hierarchy over Nested Spaces.
Again, we keep it for backward compatibility because initially the tree view from the Page Index was
displaying the Parent-Child hierarchy with pages grouped by spaces (not the pure Parent-Child hierarchy). -->
<property name="parentDoc" type="string" length="255" index="PAGE_PARENT_DOC" access="field" />
<property name="hidden" type="boolean" length="255" index="PAGE_HIDDEN" not-null="true" access="field" />
<set name="translations" lazy="true" cascade="none" access="field">
<key property-ref="pageId">
<column name="reference" />
<column name="terminal" />
</key>
<one-to-many class="com.xpn.xwiki.internal.model.XWikiPageOrSpaceTranslation" />
</set>
</class>
<!-- The entity that represents the page translations in the Nested Spaces hierarchy. This is needed
in order to be able to sort the children of a space by their localized title. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageOrSpaceTranslation" mutable="false">
<subselect><![CDATA[
select XWD_FULLNAME as reference, true as terminal, nullif(XWD_TITLE, '') as title,
XWD_LANGUAGE as locale, XWD_DEFAULT_LANGUAGE as defaultLocale
from xwikidoc
]]></subselect>
<synchronize table="xwikidoc" />
<id column="id" type="long" unsaved-value="undefined" />
<many-to-one name="page" property-ref="pageId" not-null="true" access="field">
<column name="reference" />
<column name="terminal" />
</many-to-one>
<property name="title" type="string" length="255" index="PAGE_TITLE" access="field" />
<property name="locale" type="string" index="PAGE_LOCALE" length="5" access="field" />
<property name="defaultLocale" type="string" index="PAGE_DEFAULT_LOCALE" length="5" access="field" />
</class>
</hibernate-mapping>
......@@ -434,130 +434,4 @@
<generator class="assigned" />
</id>
</class>
<!-- -->
<!-- Nested Pages Hierarchy -->
<!-- -->
<!-- When displaying the page hierarchy (e.g. using the tree widget) we need to get information from
both the documents table and the spaces table. Each of these tables contains some information that is
not found on the other. The documents table contains the terminal pages while the spaces table contains
the "empty" spaces (no direct terminal child pages). In order to get all the needed information we need
to perform a union or an outer join (between unrelated Hibernate entities). The Hibernate version we
use doesn't support either (HHH-1050 and HHH-16) so we define a new entity XWikiPage that is mapped to
a SQL query rather than to an existing table. The SQL query can be overwritten for specific databases
if needed. See XWIKI-13468. In the future we could merge the documents and spaces tables into a single
one (the pages table) -->
<class name="com.xpn.xwiki.internal.model.XWikiPage" mutable="false">
<subselect><![CDATA[
select XWS_REFERENCE as reference, false as terminal, XWS_NAME as name, XWS_PARENT as parent, XWS_HIDDEN as hidden
from xwikispace
union
select XWD_FULLNAME as reference, true as terminal, XWD_NAME as name, XWD_WEB as parent, XWD_HIDDEN as hidden
from xwikidoc
where XWD_TRANSLATION = 0 and XWD_NAME <> 'WebHome'
]]></subselect>
<synchronize table="xwikidoc" />
<synchronize table="xwikispace" />
<id column="id" type="long" unsaved-value="undefined" />
<properties name="pageId">
<property name="reference" type="string" length="255" index="PAGE_REFERENCE" not-null="true" access="field" />
<property name="terminal" type="boolean" length="255" index="PAGE_TERMINAL" not-null="true" access="field" />
</properties>
<property name="name" type="string" length="255" index="PAGE_NAME" not-null="true" access="field" />
<property name="parent" type="string" length="255" index="PAGE_PARENT" access="field" />
<property name="hidden" type="boolean" length="255" index="PAGE_HIDDEN" not-null="true" access="field" />
<!-- In order to sort the child XWikiPages by translated title (with fall-back on the default title,
see XWIKI-12832) we need to perform an outer join which is possible only between related entities thus
we aggregate the page translations here. -->
<set name="translations" lazy="true" cascade="none" access="field">
<key property-ref="pageId">
<column name="reference" />
<column name="terminal" />
</key>
<one-to-many class="com.xpn.xwiki.internal.model.XWikiPageTranslation" />
</set>
</class>
<!-- The XWikiPage translations, needed for sorting XWikiPages by their localized title. The pages
that correspond to "empty" spaces don't have associated translations. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageTranslation" mutable="false">
<subselect><![CDATA[
select case when XWD_NAME = 'WebHome' then XWD_WEB else XWD_FULLNAME end as reference,
case when XWD_NAME = 'WebHome' then false else true end as terminal,
nullif(XWD_TITLE, '') as title, XWD_LANGUAGE as locale, XWD_DEFAULT_LANGUAGE as defaultLocale
from xwikidoc
]]></subselect>
<synchronize table="xwikidoc" />
<id column="id" type="long" unsaved-value="undefined" />
<many-to-one name="page" property-ref="pageId" not-null="true" access="field">
<column name="reference" />
<column name="terminal" />
</many-to-one>
<property name="title" type="string" length="255" index="PAGE_TITLE" access="field" />
<property name="locale" type="string" index="PAGE_LOCALE" length="5" access="field" />
<property name="defaultLocale" type="string" index="PAGE_DEFAULT_LOCALE" length="5" access="field" />
</class>
<!-- -->
<!-- Nested Spaces Hierarchy -->
<!-- -->
<!-- This entity is used to represent the Nested Spaces hierarchy, which we don't use in practice
(we normally use the Nested Pages hierarchy instead) but the Document Tree has an option to display it
so we keep this entity for backward compatibility. Even though the page and the space entities are distinct
in this hierarchy, a space can have both page and space children so we still need to query them together
in order to support sort and pagination. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageOrSpace" mutable="false">
<subselect><![CDATA[
select XWS_REFERENCE as reference, false as terminal, XWS_NAME as name,
XWS_PARENT as parent, null as parentDoc, XWS_HIDDEN as hidden
from xwikispace
union
select XWD_FULLNAME as reference, true as terminal, XWD_NAME as name,
XWD_WEB as parent, XWD_PARENT as parentDoc, XWD_HIDDEN as hidden
from xwikidoc
where XWD_TRANSLATION = 0
]]></subselect>
<synchronize table="xwikidoc" />
<synchronize table="xwikispace" />
<id column="id" type="long" unsaved-value="undefined" />
<properties name="pageId">
<property name="reference" type="string" length="255" index="PAGE_REFERENCE" not-null="true" access="field" />
<property name="terminal" type="boolean" length="255" index="PAGE_TERMINAL" not-null="true" access="field" />
</properties>
<property name="name" type="string" length="255" index="PAGE_NAME" not-null="true" access="field" />
<property name="parent" type="string" length="255" index="PAGE_PARENT" access="field" />
<!-- This is needed in order to implement the deprecated Parent-Child hierarchy over Nested Spaces.
Again, we keep it for backward compatibility because initially the tree view from the Page Index was
displaying the Parent-Child hierarchy with pages grouped by spaces (not the pure Parent-Child hierarchy). -->
<property name="parentDoc" type="string" length="255" index="PAGE_PARENT_DOC" access="field" />
<property name="hidden" type="boolean" length="255" index="PAGE_HIDDEN" not-null="true" access="field" />
<set name="translations" lazy="true" cascade="none" access="field">
<key property-ref="pageId">
<column name="reference" />
<column name="terminal" />
</key>
<one-to-many class="com.xpn.xwiki.internal.model.XWikiPageOrSpaceTranslation" />
</set>
</class>
<!-- The entity that represents the page translations in the Nested Spaces hierarchy. This is needed
in order to be able to sort the children of a space by their localized title. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageOrSpaceTranslation" mutable="false">
<subselect><![CDATA[
select XWD_FULLNAME as reference, true as terminal, nullif(XWD_TITLE, '') as title,
XWD_LANGUAGE as locale, XWD_DEFAULT_LANGUAGE as defaultLocale
from xwikidoc
]]></subselect>
<synchronize table="xwikidoc" />
<id column="id" type="long" unsaved-value="undefined" />
<many-to-one name="page" property-ref="pageId" not-null="true" access="field">
<column name="reference" />
<column name="terminal" />
</many-to-one>
<property name="title" type="string" length="255" index="PAGE_TITLE" access="field" />
<property name="locale" type="string" index="PAGE_LOCALE" length="5" access="field" />
<property name="defaultLocale" type="string" index="PAGE_DEFAULT_LOCALE" length="5" access="field" />
</class>
</hibernate-mapping>
......@@ -436,130 +436,4 @@
<generator class="assigned" />
</id>
</class>
<!-- -->
<!-- Nested Pages Hierarchy -->
<!-- -->
<!-- When displaying the page hierarchy (e.g. using the tree widget) we need to get information from
both the documents table and the spaces table. Each of these tables contains some information that is
not found on the other. The documents table contains the terminal pages while the spaces table contains
the "empty" spaces (no direct terminal child pages). In order to get all the needed information we need
to perform a union or an outer join (between unrelated Hibernate entities). The Hibernate version we
use doesn't support either (HHH-1050 and HHH-16) so we define a new entity XWikiPage that is mapped to
a SQL query rather than to an existing table. The SQL query can be overwritten for specific databases
if needed. See XWIKI-13468. In the future we could merge the documents and spaces tables into a single
one (the pages table) -->
<class name="com.xpn.xwiki.internal.model.XWikiPage" mutable="false">
<subselect><![CDATA[
select XWS_REFERENCE as reference, false as terminal, XWS_NAME as name, XWS_PARENT as parent, XWS_HIDDEN as hidden
from xwikispace
union
select XWD_FULLNAME as reference, true as terminal, XWD_NAME as name, XWD_WEB as parent, XWD_HIDDEN as hidden
from xwikidoc
where XWD_TRANSLATION = 0 and XWD_NAME <> 'WebHome'
]]></subselect>
<synchronize table="xwikidoc" />
<synchronize table="xwikispace" />
<id column="id" type="long" unsaved-value="undefined" />
<properties name="pageId">
<property name="reference" type="string" length="255" index="PAGE_REFERENCE" not-null="true" access="field" />
<property name="terminal" type="boolean" length="255" index="PAGE_TERMINAL" not-null="true" access="field" />
</properties>
<property name="name" type="string" length="255" index="PAGE_NAME" not-null="true" access="field" />
<property name="parent" type="string" length="255" index="PAGE_PARENT" access="field" />
<property name="hidden" type="boolean" length="255" index="PAGE_HIDDEN" not-null="true" access="field" />
<!-- In order to sort the child XWikiPages by translated title (with fall-back on the default title,
see XWIKI-12832) we need to perform an outer join which is possible only between related entities thus
we aggregate the page translations here. -->
<set name="translations" lazy="true" cascade="none" access="field">
<key property-ref="pageId">
<column name="reference" />
<column name="terminal" />
</key>
<one-to-many class="com.xpn.xwiki.internal.model.XWikiPageTranslation" />
</set>
</class>
<!-- The XWikiPage translations, needed for sorting XWikiPages by their localized title. The pages
that correspond to "empty" spaces don't have associated translations. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageTranslation" mutable="false">
<subselect><![CDATA[
select case when XWD_NAME = 'WebHome' then XWD_WEB else XWD_FULLNAME end as reference,
case when XWD_NAME = 'WebHome' then false else true end as terminal,
nullif(XWD_TITLE, '') as title, XWD_LANGUAGE as locale, XWD_DEFAULT_LANGUAGE as defaultLocale
from xwikidoc
]]></subselect>
<synchronize table="xwikidoc" />
<id column="id" type="long" unsaved-value="undefined" />
<many-to-one name="page" property-ref="pageId" not-null="true" access="field">
<column name="reference" />
<column name="terminal" />
</many-to-one>
<property name="title" type="string" length="255" index="PAGE_TITLE" access="field" />
<property name="locale" type="string" index="PAGE_LOCALE" length="5" access="field" />
<property name="defaultLocale" type="string" index="PAGE_DEFAULT_LOCALE" length="5" access="field" />
</class>
<!-- -->
<!-- Nested Spaces Hierarchy -->
<!-- -->
<!-- This entity is used to represent the Nested Spaces hierarchy, which we don't use in practice
(we normally use the Nested Pages hierarchy instead) but the Document Tree has an option to display it
so we keep this entity for backward compatibility. Even though the page and the space entities are distinct
in this hierarchy, a space can have both page and space children so we still need to query them together
in order to support sort and pagination. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageOrSpace" mutable="false">
<subselect><![CDATA[
select XWS_REFERENCE as reference, false as terminal, XWS_NAME as name,
XWS_PARENT as parent, null as parentDoc, XWS_HIDDEN as hidden
from xwikispace
union
select XWD_FULLNAME as reference, true as terminal, XWD_NAME as name,
XWD_WEB as parent, XWD_PARENT as parentDoc, XWD_HIDDEN as hidden
from xwikidoc
where XWD_TRANSLATION = 0
]]></subselect>
<synchronize table="xwikidoc" />
<synchronize table="xwikispace" />
<id column="id" type="long" unsaved-value="undefined" />
<properties name="pageId">
<property name="reference" type="string" length="255" index="PAGE_REFERENCE" not-null="true" access="field" />
<property name="terminal" type="boolean" length="255" index="PAGE_TERMINAL" not-null="true" access="field" />
</properties>
<property name="name" type="string" length="255" index="PAGE_NAME" not-null="true" access="field" />
<property name="parent" type="string" length="255" index="PAGE_PARENT" access="field" />
<!-- This is needed in order to implement the deprecated Parent-Child hierarchy over Nested Spaces.
Again, we keep it for backward compatibility because initially the tree view from the Page Index was
displaying the Parent-Child hierarchy with pages grouped by spaces (not the pure Parent-Child hierarchy). -->
<property name="parentDoc" type="string" length="255" index="PAGE_PARENT_DOC" access="field" />
<property name="hidden" type="boolean" length="255" index="PAGE_HIDDEN" not-null="true" access="field" />
<set name="translations" lazy="true" cascade="none" access="field">
<key property-ref="pageId">
<column name="reference" />
<column name="terminal" />
</key>
<one-to-many class="com.xpn.xwiki.internal.model.XWikiPageOrSpaceTranslation" />
</set>
</class>
<!-- The entity that represents the page translations in the Nested Spaces hierarchy. This is needed
in order to be able to sort the children of a space by their localized title. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageOrSpaceTranslation" mutable="false">
<subselect><![CDATA[
select XWD_FULLNAME as reference, true as terminal, nullif(XWD_TITLE, '') as title,
XWD_LANGUAGE as locale, XWD_DEFAULT_LANGUAGE as defaultLocale
from xwikidoc
]]></subselect>
<synchronize table="xwikidoc" />
<id column="id" type="long" unsaved-value="undefined" />
<many-to-one name="page" property-ref="pageId" not-null="true" access="field">
<column name="reference" />
<column name="terminal" />
</many-to-one>
<property name="title" type="string" length="255" index="PAGE_TITLE" access="field" />
<property name="locale" type="string" index="PAGE_LOCALE" length="5" access="field" />
<property name="defaultLocale" type="string" index="PAGE_DEFAULT_LOCALE" length="5" access="field" />
</class>
</hibernate-mapping>
......@@ -459,130 +459,4 @@
<generator class="assigned" />
</id>
</class>
<!-- -->
<!-- Nested Pages Hierarchy -->
<!-- -->
<!-- When displaying the page hierarchy (e.g. using the tree widget) we need to get information from
both the documents table and the spaces table. Each of these tables contains some information that is
not found on the other. The documents table contains the terminal pages while the spaces table contains
the "empty" spaces (no direct terminal child pages). In order to get all the needed information we need
to perform a union or an outer join (between unrelated Hibernate entities). The Hibernate version we
use doesn't support either (HHH-1050 and HHH-16) so we define a new entity XWikiPage that is mapped to
a SQL query rather than to an existing table. The SQL query can be overwritten for specific databases
if needed. See XWIKI-13468. In the future we could merge the documents and spaces tables into a single
one (the pages table) -->
<class name="com.xpn.xwiki.internal.model.XWikiPage" mutable="false">
<subselect><![CDATA[
select XWS_REFERENCE as reference, false as terminal, XWS_NAME as name, XWS_PARENT as parent, XWS_HIDDEN as hidden
from xwikispace
union
select XWD_FULLNAME as reference, true as terminal, XWD_NAME as name, XWD_WEB as parent, XWD_HIDDEN as hidden
from xwikidoc
where XWD_TRANSLATION = 0 and XWD_NAME <> 'WebHome'
]]></subselect>
<synchronize table="xwikidoc" />
<synchronize table="xwikispace" />
<id column="id" type="long" unsaved-value="undefined" />
<properties name="pageId">
<property name="reference" type="string" length="255" index="PAGE_REFERENCE" not-null="true" access="field" />
<property name="terminal" type="boolean" length="255" index="PAGE_TERMINAL" not-null="true" access="field" />
</properties>
<property name="name" type="string" length="255" index="PAGE_NAME" not-null="true" access="field" />
<property name="parent" type="string" length="255" index="PAGE_PARENT" access="field" />
<property name="hidden" type="boolean" length="255" index="PAGE_HIDDEN" not-null="true" access="field" />
<!-- In order to sort the child XWikiPages by translated title (with fall-back on the default title,
see XWIKI-12832) we need to perform an outer join which is possible only between related entities thus
we aggregate the page translations here. -->
<set name="translations" lazy="true" cascade="none" access="field">
<key property-ref="pageId">
<column name="reference" />
<column name="terminal" />
</key>
<one-to-many class="com.xpn.xwiki.internal.model.XWikiPageTranslation" />
</set>
</class>
<!-- The XWikiPage translations, needed for sorting XWikiPages by their localized title. The pages
that correspond to "empty" spaces don't have associated translations. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageTranslation" mutable="false">
<subselect><![CDATA[
select case when XWD_NAME = 'WebHome' then XWD_WEB else XWD_FULLNAME end as reference,
case when XWD_NAME = 'WebHome' then false else true end as terminal,
nullif(XWD_TITLE, '') as title, XWD_LANGUAGE as locale, XWD_DEFAULT_LANGUAGE as defaultLocale
from xwikidoc
]]></subselect>
<synchronize table="xwikidoc" />
<id column="id" type="long" unsaved-value="undefined" />
<many-to-one name="page" property-ref="pageId" not-null="true" access="field">
<column name="reference" />
<column name="terminal" />
</many-to-one>
<property name="title" type="string" length="255" index="PAGE_TITLE" access="field" />
<property name="locale" type="string" index="PAGE_LOCALE" length="5" access="field" />
<property name="defaultLocale" type="string" index="PAGE_DEFAULT_LOCALE" length="5" access="field" />
</class>
<!-- -->
<!-- Nested Spaces Hierarchy -->
<!-- -->
<!-- This entity is used to represent the Nested Spaces hierarchy, which we don't use in practice
(we normally use the Nested Pages hierarchy instead) but the Document Tree has an option to display it
so we keep this entity for backward compatibility. Even though the page and the space entities are distinct
in this hierarchy, a space can have both page and space children so we still need to query them together
in order to support sort and pagination. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageOrSpace" mutable="false">
<subselect><![CDATA[
select XWS_REFERENCE as reference, false as terminal, XWS_NAME as name,
XWS_PARENT as parent, null as parentDoc, XWS_HIDDEN as hidden
from xwikispace
union
select XWD_FULLNAME as reference, true as terminal, XWD_NAME as name,
XWD_WEB as parent, XWD_PARENT as parentDoc, XWD_HIDDEN as hidden
from xwikidoc
where XWD_TRANSLATION = 0
]]></subselect>
<synchronize table="xwikidoc" />
<synchronize table="xwikispace" />
<id column="id" type="long" unsaved-value="undefined" />
<properties name="pageId">
<property name="reference" type="string" length="255" index="PAGE_REFERENCE" not-null="true" access="field" />
<property name="terminal" type="boolean" length="255" index="PAGE_TERMINAL" not-null="true" access="field" />
</properties>
<property name="name" type="string" length="255" index="PAGE_NAME" not-null="true" access="field" />
<property name="parent" type="string" length="255" index="PAGE_PARENT" access="field" />
<!-- This is needed in order to implement the deprecated Parent-Child hierarchy over Nested Spaces.
Again, we keep it for backward compatibility because initially the tree view from the Page Index was
displaying the Parent-Child hierarchy with pages grouped by spaces (not the pure Parent-Child hierarchy). -->
<property name="parentDoc" type="string" length="255" index="PAGE_PARENT_DOC" access="field" />
<property name="hidden" type="boolean" length="255" index="PAGE_HIDDEN" not-null="true" access="field" />
<set name="translations" lazy="true" cascade="none" access="field">
<key property-ref="pageId">
<column name="reference" />
<column name="terminal" />
</key>
<one-to-many class="com.xpn.xwiki.internal.model.XWikiPageOrSpaceTranslation" />
</set>
</class>
<!-- The entity that represents the page translations in the Nested Spaces hierarchy. This is needed
in order to be able to sort the children of a space by their localized title. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageOrSpaceTranslation" mutable="false">
<subselect><![CDATA[
select XWD_FULLNAME as reference, true as terminal, nullif(XWD_TITLE, '') as title,
XWD_LANGUAGE as locale, XWD_DEFAULT_LANGUAGE as defaultLocale
from xwikidoc
]]></subselect>
<synchronize table="xwikidoc" />
<id column="id" type="long" unsaved-value="undefined" />
<many-to-one name="page" property-ref="pageId" not-null="true" access="field">
<column name="reference" />
<column name="terminal" />
</many-to-one>
<property name="title" type="string" length="255" index="PAGE_TITLE" access="field" />
<property name="locale" type="string" index="PAGE_LOCALE" length="5" access="field" />
<property name="defaultLocale" type="string" index="PAGE_DEFAULT_LOCALE" length="5" access="field" />
</class>
</hibernate-mapping>
......@@ -437,130 +437,4 @@
<generator class="assigned" />
</id>
</class>
<!-- -->
<!-- Nested Pages Hierarchy -->
<!-- -->
<!-- When displaying the page hierarchy (e.g. using the tree widget) we need to get information from
both the documents table and the spaces table. Each of these tables contains some information that is
not found on the other. The documents table contains the terminal pages while the spaces table contains
the "empty" spaces (no direct terminal child pages). In order to get all the needed information we need
to perform a union or an outer join (between unrelated Hibernate entities). The Hibernate version we
use doesn't support either (HHH-1050 and HHH-16) so we define a new entity XWikiPage that is mapped to
a SQL query rather than to an existing table. The SQL query can be overwritten for specific databases
if needed. See XWIKI-13468. In the future we could merge the documents and spaces tables into a single
one (the pages table) -->
<class name="com.xpn.xwiki.internal.model.XWikiPage" mutable="false">
<subselect><![CDATA[
select XWS_REFERENCE as reference, false as terminal, XWS_NAME as name, XWS_PARENT as parent, XWS_HIDDEN as hidden
from xwikispace
union
select XWD_FULLNAME as reference, true as terminal, XWD_NAME as name, XWD_WEB as parent, XWD_HIDDEN as hidden
from xwikidoc
where XWD_TRANSLATION = 0 and XWD_NAME <> 'WebHome'
]]></subselect>
<synchronize table="xwikidoc" />
<synchronize table="xwikispace" />
<id column="id" type="long" unsaved-value="undefined" />
<properties name="pageId">
<property name="reference" type="string" length="255" index="PAGE_REFERENCE" not-null="true" access="field" />
<property name="terminal" type="boolean" length="255" index="PAGE_TERMINAL" not-null="true" access="field" />
</properties>
<property name="name" type="string" length="255" index="PAGE_NAME" not-null="true" access="field" />
<property name="parent" type="string" length="255" index="PAGE_PARENT" access="field" />
<property name="hidden" type="boolean" length="255" index="PAGE_HIDDEN" not-null="true" access="field" />
<!-- In order to sort the child XWikiPages by translated title (with fall-back on the default title,
see XWIKI-12832) we need to perform an outer join which is possible only between related entities thus
we aggregate the page translations here. -->
<set name="translations" lazy="true" cascade="none" access="field">
<key property-ref="pageId">
<column name="reference" />
<column name="terminal" />
</key>
<one-to-many class="com.xpn.xwiki.internal.model.XWikiPageTranslation" />
</set>
</class>
<!-- The XWikiPage translations, needed for sorting XWikiPages by their localized title. The pages
that correspond to "empty" spaces don't have associated translations. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageTranslation" mutable="false">
<subselect><![CDATA[
select case when XWD_NAME = 'WebHome' then XWD_WEB else XWD_FULLNAME end as reference,
case when XWD_NAME = 'WebHome' then false else true end as terminal,
nullif(XWD_TITLE, '') as title, XWD_LANGUAGE as locale, XWD_DEFAULT_LANGUAGE as defaultLocale
from xwikidoc
]]></subselect>
<synchronize table="xwikidoc" />
<id column="id" type="long" unsaved-value="undefined" />
<many-to-one name="page" property-ref="pageId" not-null="true" access="field">
<column name="reference" />
<column name="terminal" />
</many-to-one>
<property name="title" type="string" length="255" index="PAGE_TITLE" access="field" />
<property name="locale" type="string" index="PAGE_LOCALE" length="5" access="field" />
<property name="defaultLocale" type="string" index="PAGE_DEFAULT_LOCALE" length="5" access="field" />
</class>
<!-- -->
<!-- Nested Spaces Hierarchy -->
<!-- -->
<!-- This entity is used to represent the Nested Spaces hierarchy, which we don't use in practice
(we normally use the Nested Pages hierarchy instead) but the Document Tree has an option to display it
so we keep this entity for backward compatibility. Even though the page and the space entities are distinct
in this hierarchy, a space can have both page and space children so we still need to query them together
in order to support sort and pagination. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageOrSpace" mutable="false">
<subselect><![CDATA[
select XWS_REFERENCE as reference, false as terminal, XWS_NAME as name,
XWS_PARENT as parent, null as parentDoc, XWS_HIDDEN as hidden
from xwikispace
union
select XWD_FULLNAME as reference, true as terminal, XWD_NAME as name,
XWD_WEB as parent, XWD_PARENT as parentDoc, XWD_HIDDEN as hidden
from xwikidoc
where XWD_TRANSLATION = 0
]]></subselect>
<synchronize table="xwikidoc" />
<synchronize table="xwikispace" />
<id column="id" type="long" unsaved-value="undefined" />
<properties name="pageId">
<property name="reference" type="string" length="255" index="PAGE_REFERENCE" not-null="true" access="field" />
<property name="terminal" type="boolean" length="255" index="PAGE_TERMINAL" not-null="true" access="field" />
</properties>
<property name="name" type="string" length="255" index="PAGE_NAME" not-null="true" access="field" />
<property name="parent" type="string" length="255" index="PAGE_PARENT" access="field" />
<!-- This is needed in order to implement the deprecated Parent-Child hierarchy over Nested Spaces.
Again, we keep it for backward compatibility because initially the tree view from the Page Index was
displaying the Parent-Child hierarchy with pages grouped by spaces (not the pure Parent-Child hierarchy). -->
<property name="parentDoc" type="string" length="255" index="PAGE_PARENT_DOC" access="field" />
<property name="hidden" type="boolean" length="255" index="PAGE_HIDDEN" not-null="true" access="field" />
<set name="translations" lazy="true" cascade="none" access="field">
<key property-ref="pageId">
<column name="reference" />
<column name="terminal" />
</key>
<one-to-many class="com.xpn.xwiki.internal.model.XWikiPageOrSpaceTranslation" />
</set>
</class>
<!-- The entity that represents the page translations in the Nested Spaces hierarchy. This is needed
in order to be able to sort the children of a space by their localized title. -->
<class name="com.xpn.xwiki.internal.model.XWikiPageOrSpaceTranslation" mutable="false">
<subselect><![CDATA[
select XWD_FULLNAME as reference, true as terminal, nullif(XWD_TITLE, '') as title,
XWD_LANGUAGE as locale, XWD_DEFAULT_LANGUAGE as defaultLocale
from xwikidoc
]]></subselect>
<synchronize table="xwikidoc" />
<id column="id" type="long" unsaved-value="undefined" />
<many-to-one name="page" property-ref="pageId" not-null="true" access="field">
<column name="reference" />
<column name="terminal" />
</many-to-one>
<property name="title" type="string" length="255" index="PAGE_TITLE" access="field" />
<property name="locale" type="string" index="PAGE_LOCALE" length="5" access="field" />
<property name="defaultLocale" type="string" index="PAGE_DEFAULT_LOCALE" length="5" access="field" />
</class>
</hibernate-mapping>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment