Note that there are some explanatory texts on larger screens.

plurals
  1. PONHibernate AssertException: Interceptor.OnPrepareStatement(SqlString) returned null or empty SqlString
    primarykey
    data
    text
    <p>I am trying to switch a table from being a many-to-one mapping to being many-to-many with an intermediate mapping table. However, when I switched it over and tried to do a query on it with NHibernate, it's giving me this error: "Interceptor.OnPrepareStatement(SqlString) returned null or empty SqlString."</p> <p>My query was originally something more complex, but I switched it to a basic fetch all and I'm still having the problem:</p> <pre><code>Session.QueryOver&lt;T&gt;().Future(); </code></pre> <p>It would seem to either be a problem in my model mapping files or something in my database.</p> <p>Here are my model mappings:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="GBI.Core" namespace="GBI.Core.Models"&gt; &lt;class name="Market" table="gbi_Market"&gt; &lt;id name="Id" column="MarketId"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="Name" /&gt; &lt;property name="Url" /&gt; &lt;property name="Description" type="StringClob" /&gt; &lt;property name="Rating" /&gt; &lt;property name="RatingComment" /&gt; &lt;property name="RatingCommentedOn" /&gt; &lt;many-to-one name="RatingCommentedBy" column="RatingCommentedBy" lazy="proxy"&gt;&lt;/many-to-one&gt; &lt;property name="ImageFilename" /&gt; &lt;property name="CreatedOn" /&gt; &lt;property name="ModifiedOn" /&gt; &lt;property name="IsDeleted" /&gt; &lt;many-to-one name="CreatedBy" column="CreatedBy" lazy="proxy"&gt;&lt;/many-to-one&gt; &lt;many-to-one name="ModifiedBy" column="ModifiedBy" lazy="proxy"&gt;&lt;/many-to-one&gt; &lt;set name="Content" where="IsDeleted=0 and ParentContentId is NULL" order-by="Ordering asc, CreatedOn asc, Name asc" lazy="extra"&gt; &lt;key column="MarketId" /&gt; &lt;one-to-many class="MarketContent" /&gt; &lt;/set&gt; &lt;set name="FastFacts" where="IsDeleted=0" order-by="Ordering asc, CreatedOn asc, Name asc" lazy="extra"&gt; &lt;key column="MarketId" /&gt; &lt;one-to-many class="MarketFastFact" /&gt; &lt;/set&gt; &lt;set name="NewsItems" table="gbi_NewsItem_Market_Map" lazy="true"&gt; &lt;key column="MarketId" /&gt; &lt;many-to-many class="NewsItem" fetch="join" column="NewsItemId" where="IsDeleted=0"/&gt; &lt;/set&gt; &lt;!--&lt;set name="MarketUpdates" table="gbi_Market_MarketUpdate_Map" lazy="extra"&gt; &lt;key column="MarketId" /&gt; &lt;many-to-many class="MarketUpdate" fetch="join" column="MarketUpdateId" where="IsDeleted=0" order-by="CreatedOn desc" /&gt; &lt;/set&gt;--&gt; &lt;set name="Documents" table="gbi_Market_Document_Map" lazy="true"&gt; &lt;key column="MarketId" /&gt; &lt;many-to-many class="Document" fetch="join" column="DocumentId" where="IsDeleted=0"/&gt; &lt;/set&gt; &lt;/class&gt; </code></pre> <p></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="GBI.Core" namespace="GBI.Core.Models"&gt; &lt;class name="MarketUpdate" table="gbi_MarketUpdate"&gt; &lt;id name="Id" column="MarketUpdateId"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="Description" /&gt; &lt;property name="CreatedOn" /&gt; &lt;property name="ModifiedOn" /&gt; &lt;property name="IsDeleted" /&gt; &lt;!--&lt;many-to-one name="Market" column="MarketId" lazy="proxy"&gt;&lt;/many-to-one&gt;--&gt; &lt;set name="Comments" where="IsDeleted=0" order-by="CreatedOn desc" lazy="extra"&gt; &lt;key column="MarketUpdateId" /&gt; &lt;one-to-many class="MarketUpdateComment" /&gt; &lt;/set&gt; &lt;many-to-one name="CreatedBy" column="CreatedBy" lazy="proxy"&gt;&lt;/many-to-one&gt; &lt;many-to-one name="ModifiedBy" column="ModifiedBy" lazy="proxy"&gt;&lt;/many-to-one&gt; &lt;/class&gt; </code></pre> <p></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="GBI.Core" namespace="GBI.Core.Models"&gt; &lt;class name="MarketUpdateMarketMap" table="gbi_Market_MarketUpdate_Map"&gt; &lt;id name="Id" column="MarketUpdateMarketMapId"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="CreatedOn" /&gt; &lt;property name="ModifiedOn" /&gt; &lt;property name="IsDeleted" /&gt; &lt;many-to-one name="CreatedBy" column="CreatedBy" lazy="proxy"&gt;&lt;/many-to-one&gt; &lt;many-to-one name="ModifiedBy" column="ModifiedBy" lazy="proxy"&gt;&lt;/many-to-one&gt; &lt;many-to-one name="MarketUpdate" column="MarketUpdateId" lazy="proxy"&gt;&lt;/many-to-one&gt; &lt;many-to-one name="Market" column="MarketId" lazy="proxy"&gt;&lt;/many-to-one&gt; &lt;/class&gt; </code></pre> <p></p> <p>As I mentioned, MarketUpdate was originally a many-to-one with Market (MarketId column is still in there, but I'm ignoring it. Could this be a problem?). But I've added in the Market_MarketUpdate_Map table to make it a many-to-many.</p> <p>I'm running in circles trying to figure out what this could be. I couldn't find any reference to this error when searching. And it doesn't provide much detail.</p> <p>Using:</p> <p>NHibernate 2.2</p> <p>.NET 4.0</p> <p>SQL Server 2005</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload