Possible bug when HTML/XML is in the column data 2.0.CR2
Ramon <[email protected]> Fri, 15 Aug 2008 11:30:03 +0200
| Newsgroups | gmane.comp.windows.dotnet.nhibernate.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all, I am having the following problem: - A table where a column has html data. - I enabled nhibernate query logging - I enabled the SQL profiler. The query executed on the database is : exec sp_executesql N'SELECT this_.Language_Id as Language1_19_0_, this_.Webcast_Id as Webcast2_19_0_, this_.Addon_Id as Addon3_19_0_, this_.Template_Id as Template4_19_0_, this_.Name as Name19_0_, this_.Body as Body19_0_, this_.Index_Nr as Index7_19_0_, this_.Custom as Custom19_0_, this_.LiveStatusVisibility as LiveStat9_19_0_ FROM AddonBasic this_ WHERE this_.Webcast_Id = @p0 and this_.Language_Id = @p1 and this_.Addon_Id = @p2', N'@p0 int,@p1 int,@p2 int', @p0 = 1067, @p1 = 1, @p2 = 1 The query executes fine and has a one row result but NHibernate crashes and this is the tail of the log: =[START]============================================ NHibernate: SELECT this_.Language_Id as Language1_19_0_, this_.Webcast_Id as Webcast2_19_0_, this_.Addon_Id as Addon3_19_0_, this_.Template_Id as Template4_19_0_, this_.Name as Name19_0_, this_.Body as Body19_0_, this_.Index_Nr as Index7_19_0_, this_.Custom as Custom19_0_, this_.LiveStatusVisibility as LiveStat9_19_0_ FROM AddonBasic this_ WHERE this_.Webcast_Id = @p0 and this_.Language_Id = @p1 and this_.Addon_Id = @p2; @p0 = '1067', @p1 = '1', @p2 = '1' TestCase 'ServiceDemoTest.PlayerServiceTest.TestWelcome' failed: NHibernate.ADOException: could not execute query [ SELECT this_.Language_Id as Language1_19_0_, this_.Webcast_Id as Webcast2_19_0_, this_.Addon_Id as Addon3_19_0_, this_.Template_Id as Template4_19_0_, this_.Name as Name19_0_, this_.Body as Body19_0_, this_.Index_Nr as Index7_19_0_, this_.Custom as Custom19_0_, this_.LiveStatusVisibility as LiveStat9_19_0_ FROM AddonBasic this_ WHERE this_.Webcast_Id = ? and this_.Language_Id = ? and this_.Addon_Id = ? ] Positional parameters: #0>1067 #0>Dutch #0>Welcome [SQL: SELECT this_.Language_Id as Language1_19_0_, this_.Webcast_Id as Webcast2_19_0_, this_.Addon_Id as Addon3_19_0_, this_.Template_Id as Template4_19_0_, this_.Name as Name19_0_, this_.Body as Body19_0_, this_.Index_Nr as Index7_19_0_, this_.Custom as Custom19_0_, this_.LiveStatusVisibility as LiveStat9_19_0_ FROM AddonBasic this_ WHERE this_.Webcast_Id = ? and this_.Language_Id = ? and this_.Addon_Id = ?] NHibernate.ADOException: could not execute query [ SELECT this_.Language_Id as Language1_19_0_, this_.Webcast_Id as Webcast2_19_0_, this_.Addon_Id as Addon3_19_0_, this_.Template_Id as Template4_19_0_, this_.Name as Name19_0_, this_.Body as Body19_0_, this_.Index_Nr as Index7_19_0_, this_.Custom as Custom19_0_, this_.LiveStatusVisibility as LiveStat9_19_0_ FROM AddonBasic this_ WHERE this_.Webcast_Id = ? and this_.Language_Id = ? and this_.Addon_Id = ? ] Positional parameters: #0>1067 #0>Dutch #0>Welcome [SQL: SELECT this_.Language_Id as Language1_19_0_, this_.Webcast_Id as Webcast2_19_0_, this_.Addon_Id as Addon3_19_0_, this_.Template_Id as Template4_19_0_, this_.Name as Name19_0_, this_.Body as Body19_0_, this_.Index_Nr as Index7_19_0_, this_.Custom as Custom19_0_, this_.LiveStatusVisibility as LiveStat9_19_0_ FROM AddonBasic this_ WHERE this_.Webcast_Id = ? and this_.Language_Id = ? and this_.Addon_Id = ?] ---> System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.LoadXml(String xml) at System.Xml.XmlDocument.set_InnerXml(String value) C:\svn.metadata\Demo\ServiceDemo\DAL\Webcast.cs(781,0): at Dal.AddonBasic.set_Custom(String value) at (Object , Object[] , SetterCallback ) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Bytecode\Lightweight\AccessOptimizer.cs(32,0): at NHibernate.Bytecode.Lightweight.AccessOptimizer.SetPropertyValues(Object target, Object[] values) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Tuple\Entity\PocoEntityTuplizer.cs(271,0): at NHibernate.Tuple.Entity.PocoEntityTuplizer.SetPropertyValuesWithOptimizer(Object entity, Object[] values) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Tuple\Entity\PocoEntityTuplizer.cs(259,0): at NHibernate.Tuple.Entity.PocoEntityTuplizer.SetPropertyValues(Object entity, Object[] values) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs(3720,0): at NHibernate.Persister.Entity.AbstractEntityPersister.SetPropertyValues(Object obj, Object[] values, EntityMode entityMode) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Engine\TwoPhaseLoad.cs(87,0): at NHibernate.Engine.TwoPhaseLoad.InitializeEntity(Object entity, Boolean readOnly, ISessionImplementor session, PreLoadEvent preLoadEvent, PostLoadEvent postLoadEvent) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Loader\Loader.cs(617,0): at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session, Boolean readOnly) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Loader\Loader.cs(466,0): at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Loader\Loader.cs(187,0): at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Loader\Loader.cs(1803,0): at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) --- End of inner exception stack trace --- c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Loader\Loader.cs(1812,0): at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Loader\Loader.cs(1718,0): at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Loader\Loader.cs(1712,0): at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Loader\Criteria\CriteriaLoader.cs(67,0): at NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Impl\SessionImpl.cs(1594,0): at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Impl\CriteriaImpl.cs(455,0): at NHibernate.Impl.CriteriaImpl.List(IList results) c:\CSharp\NH2.0.0\nhibernate\src\NHibernate\Impl\CriteriaImpl.cs(466,0): at NHibernate.Impl.CriteriaImpl.List[T]() =[ END ]============================================ It seems that NHibernate puts the query result in an xml like structure and the only obvious thing that comes to mind is that the data returned from the database isn't escaped. The data returned isn't valid xml (its xml). I will try to hunt down this exception this weekend with the nhibernate sources but wanted to this list as I don't know where and how to report (possible) bugs. Ramon ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/