[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-944) In one-to-many relationship (Set, Map, List), let <key> accept <formula> as an alternative to <column>.
Xavier Brénuchon (JIRA)
noreply at atlassian.com
Thu Sep 7 09:30:24 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-944?page=comments#action_24360 ]
Xavier Brénuchon commented on HHH-944:
--------------------------------------
Hello,
I am also very interested by this functionality.
We develop an application which has very strong need for performance with several tens of million recordings. Partitioning is a need.
Because all my tables have a column of partitioning, I need to use shared composite key attribute for all my relations.
So for a <many-to-many>, I use the example of the doc (23.4.3 :)
<class name="User" table="User">
<composite-id>
<key-property name="name"/>
<key-property name="org"/>
</composite-id>
<set name="groups" table="UserGroup">
<key>
<column name="userName"/>
<column name="org"/>
</key>
<many-to-many class="Group">
<column name="groupName"/>
<formula>org</formula>
</many-to-many>
</set>
</class>
For a <many-to-one> I use :
<class name="User" table="User">
<composite-id>
<key-property name="name"/>
<key-property name="org"/>
</composite-id>
<many-to-one name="team">
<formula>org</formula>
<column name="FK_TEAM"/>
</many-to-one>
</class>
The only problem is for <one-to-many> because <formula> is not possible in <key> :
<class name="User" table="User">
<composite-id>
<key-property name="name"/>
<key-property name="org"/>
</composite-id>
<set name="contrats" cascade="all, delete-orphan">
<key>
<!-- formula is not authorized :( -->
<formula>org</formula>
<column name="FK_USER"/>
</key>
<one-to-many class="Contrat"/>
</set>
</class>
<class name="Contrat" table="CONTRAT">
<composite-id>
<key-property name="name"/>
<key-property name="org"/>
</composite-id>
<!-- ... -->
</class>
It is a limitation which prevents the use of a effective partitioning in data base.
I carried out a test by modifying the source code of hibernate that can function without many modifications.
Is it possible that Hibernate is enriched by this functionality?
> In one-to-many relationship (Set, Map, List), let <key> accept <formula> as an alternative to <column>.
> ---------------------------------------------------------------------------------------------------------
>
> Key: HHH-944
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-944
> Project: Hibernate3
> Type: New Feature
> Versions: 3.1 rc3
> Reporter: Etienne Laverdiere
>
>
> As explain in http://forum.hibernate.org/viewtopic.php?t=947249&highlight=&sid=c6df51fcf4a97edac80b76c317c51852 and alternatively in http://forum.hibernate.org/viewtopic.php?t=947145&highlight=&sid=c6df51fcf4a97edac80b76c317c51852, it would be nice if the <key> inside a SET or any collection (one-to-many relationship) could accept a <formula> instead of the column:
> Example:
> <set name="childrens" lazy="true" inverse="true">
> <key foreign-key="FinancialTransit">
> <formula>ANY SQL</formula>
> </key>
> <one-to-many class="com.eg.Children" />
> </set>
> instead of :
> <set name="childrens" lazy="true" inverse="true">
> <key foreign-key="key1">
> <column name="key2" scale="10"
> precision="0" not-null="false" unique="true" />
> </key>
> <one-to-many class="com.eg.Children" />
> </set>
> It would necessitate to patch the class AbstractCollectionPersister and modify the DTD of hibernate mapping.
> Regards,
> Etienne
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list