I have already read it. But I didn't understand, how it helps me? I can not understand, why NHibernate can compare object using composite ID in Session.Update method, but it can't do it when I make update in HQL?
On Wed, Mar 17, 2010 at 8:02 PM, John Davidson <[email protected]> wrote: > Composite keys seem to require extra special handling, beyond the logical > expectation It is explained well here > > > http://devlicio.us/blogs/anne_epstein/archive/2009/11/20/nhibernate-and-composite-keys.aspx > > Hope this helps > > John Davidson > > > On Wed, Mar 17, 2010 at 10:07 AM, VD <[email protected]> wrote: > >> I faced with this exception in my big solution, but I localized the >> problem to small project: >> I have an A class which has composite key with specific type. >> Then I try to make custom update which looks like: >> ISession session = sessionFactory.OpenSession(); >> session.CreateQuery("update A a set a.Data = :data >> where a.Id = :id").SetString("data", "some data"). >> SetParameter("id", new AId(1, 1)). >> ExecuteUpdate(); >> ExecuteUpdate leads me to exception: "SqlNode's text did not reference >> expected number of columns". >> >> Mappings: >> <?xml version="1.0" encoding="utf-8" ?> >> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Main" >> assembly="Main"> >> >> <class name="A" table="A"> >> <composite-id name="Id" class="AId"> >> <key-property name="Id" column="Id" /> >> <key-property name="SecondId" column="SecondId" /> >> </composite-id> >> <property name="Data" /> >> </class> >> >> </hibernate-mapping> >> Classes are very simple, I hope it is not requred to reproduce the >> problem... >> >> -- >> 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]<nhusers%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> >> > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- 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.
