I'm not familiar with this feature, but I'll take a guess: You don't want to create a map for PatientVisitSummary. You want to import PatientVisitSummary into one of the mapped classes, such as Patient or Visit. So don't create a PatientVisitSummaryMap, instead call ImportType from your Patient or Visit map.
If this doesn't make sense then it would help if you could post the hbm xml for this feature, it should be straightforward to provide the fluent version based on that. On Fri, Feb 26, 2010 at 10:54 AM, Jims <jimwhea...@gmail.com> wrote: > I'm having trouble getting the ImportType to work with ClassMap for > use with a 'Dynamic Instantiation class' within an HQL query. > > For background, I'm trying to follow the example in 'Nhibernate In > Action', Chpt 7 - writing report queries: > > Using Dynamic Instantiation > > If you find working with arrays of values a little cumbersome, > NHibernate let’s you use dynamic instantiation and define a class to > represent each row of results. You can do this using the HQL select > new construct: > > select new ItemRow( item.id, item.Description, bid.Amount ) > from Item item join item.Bids bid > where bid.Amount > 100 > > > Here is my (simple) example that I'm trying to get to work: > > var query = Session.CreateQuery( > @"select new PatientVisitSummary(v.id, > v.AdmissionDate) > from Patient p join p.Visits v > where p.Id = :patientId"); > query.SetParameter("patientId", patientId); > > And my classmap: > > > public class PatientVisitSummaryMap : ClassMap<PatientVisitSummary> > { > public PatientVisitSummaryMap() > { > ImportType<PatientVisitSummary>(); > } > } > > > However, when I try to execute the query, I get the following > exception: > > System.Xml.Schema.XmlSchemaValidationException: The element 'class' in > namespace 'urn:nhibernate-mapping-2.2' has incomplete content. List of > possible elements expected: 'meta, subselect, cache, synchronize, > comment, tuplizer, id, composite-id' in namespace 'urn:nhibernate- > mapping-2.2'. > > I know I'm doing something wrong, but can't figure out what. Any > advice would be greatly appreciated. > > > > > -- > You received this message because you are subscribed to the Google Groups > "Fluent NHibernate" group. > To post to this group, send email to fluent-nhibern...@googlegroups.com. > To unsubscribe from this group, send email to > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/fluent-nhibernate?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibern...@googlegroups.com. To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.