From a562acbbde4783d06f5131273a1764ae171a0c26 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sun, 22 Aug 2004 11:03:08 +0000 Subject: [PATCH] minor changes to components git-svn-id: https://svn.jboss.org/repos/hibernate/trunk/Hibernate3/doc@4414 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- reference/en/modules/component_mapping.xml | 27 ++++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/reference/en/modules/component_mapping.xml b/reference/en/modules/component_mapping.xml index dfdec65aaa..f35c647a5b 100644 --- a/reference/en/modules/component_mapping.xml +++ b/reference/en/modules/component_mapping.xml @@ -264,25 +264,21 @@ Since a composite identifier must be assigned to the object before saving it, we can't use unsaved-value of the identifier to distinguish - between newly instantiated instances and instances saved in a previous session. + between newly instantiated transient instances and detached instances from a + previous session. - You may instead implement Interceptor.isUnsaved() if - you wish to use saveOrUpdate() or cascading save / update. - As an alternative, you may also set the unsaved-value - attribute on a <version> (or - <timestamp>) element to specify a - value that indicates a new transient instance. In this case, the version - of the entity is used instead of the (assigned) identifier and you don't have - to implement Interceptor.isUnsaved() yourself. + So, if you wish to use transitive reattachment (you don't have to), you must + either implement Interceptor.isUnsaved() or define the + unsaved-value of a <version> or + <timestamp> element. - Use the <composite-id> tag (same attributes and - elements as <component>) in place of - <id> for the declaration of a composite identifier - class: + Use the <composite-id> tag (with nested + <key-property> elements) in place of the + usual <id> declaration: @@ -364,8 +360,9 @@ The semantics of a <dynamic-component> mapping are identical to <component>. The advantage of this kind of mapping is the ability to determine the actual properties of the bean at deployment time, just - by editing the mapping document. (Runtime manipulation of the mapping document is - also possible, using a DOM parser.) + by editing the mapping document. Runtime manipulation of the mapping document is + also possible, using a DOM parser. Even better, you can access (and change) Hibernate's + configuration-time metamodel via the Configuration object.