NHibernate 2.1.2GA
mapping
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="TreeViewForBD.Data.Property.PGenericProperty,FondData"
table="P_GENERIC_PROPERTY" lazy="true" dynamic-insert="true" dynamic-
update="true">
<id access="nosetter.lowercase-underscore" name="InstanceS"
column="INSTANCE_S" type="String" >
<generator class="assigned"/>
</id>
<property access="nosetter.lowercase-underscore"
column="ACTIVITY_S"
name="ActivityS" type="String"/>
<join table="P_GENERIC_PROPERTY_LU" optional="true">
<key column="INSTANCE_S"/>
<property access="nosetter.lowercase-underscore"
column="LAST_UPDATED" type="DateTime" name="LastUpdated"/>
</join>
</class>
</hibernate-mapping>
Problem reproduction:
=================
PGenericProperty pgp = new PGenericProperty()
pgp.InstanceS = "1";
ISession _session = factory.OpenSession();
_session.Save(pgp);
SQL:
INSERT INTO P_GENERIC_PROPERTY (INSTANCE_S) VALUES ('1')
Next:
pgp.LastUpdated = DateTime.Now;
ISession _session1 = factory.OpenSession(); // new session
_session.Update(pgp);
SQL:
UPDATE P_GENERIC_PROPERTY SET ACTIVITY_S = NULL /* @p0_0 */, WHERE
INSTANCE_S = '4225c2a8e7e440aa60c' /* @p77_0 */
UPDATE P_GENERIC_PROPERTY_LU SET LAST_UPDATED =
'2010-07-19T09:00:15.00' /* @p0 */
WHERE INSTANCE_S = '4225c2a8e7e440aa60c' /* @p1 */
UPDATE instead INSERT !!!
Not exists this row in table P_GENERIC_PROPERTY_LU.
(select_before_update in hbm don't help)
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.