I ran into this issue not long ago. The generic type parameter on SimpleQuery MUST be an Active Record persistent class. You can't use SimpleQuery to get DTOs or integer results.
If you go to a lower level and use the good ol' session.CreateQuery or session.CreateSqlQuery things should work just fine. Does that help? -tyler -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of stachu Sent: Wednesday, February 11, 2009 9:27 AM To: Castle Project Users Subject: AR Native Query - type not initialized Hi! I'm trying to get maximum bounding box from shapes in my Postgres db. I'm using following query: Code: SELECT min(xmin(box2d(shape))), " + "min(ymin(box2d (shape))), " + "max(xmax(box2d (shape))), " + "max(ymax(box2d (shape))) FROM drawings It works fine with Ado.Net and npgsql. Now i'm migrating to ActiveRecord and try to execute above query as NativeQuery. I do this in follwoing way: Code: SimpleQuery<long[]> simpleQuery = new SimpleQuery<long[]> (QueryLanguage.Sql, MAX_BOUNDING_BOX_QUERY); long[][] result = simpleQuery.Execute(); Hovever I get following error: Quote: You have accessed an ActiveRecord class that wasn't properly initialized. The only explanation is that the call to ActiveRecordStarter.Initialize() didn't include System.Int64[] class I also tried session.createSQLQuery() with following code: Code: ISQLQuery sqlQuery = this.m_database.GetSessionFactoryHolder ().CreateSession (typeof (DrawingAR)).CreateSQLQuery ( MAX_BOUNDING_BOX_QUERY); IList list = sqlQuery.List (); long[] result = (long[]) list[0]; but then i get Quote: Return types of SQL query were not specified [SELECT min(xmin(box2d (shape))) as a, min(ymin(box2d(shape))) as b, max(xmax(box2d(shape))) as c, max(ymax(box2d(shape))) as d FROM drawings;] any ide how to get it work? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
