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.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to