Skip to content

Commit

Permalink
Enable tests for PostgreSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
bahusoid committed Jul 31, 2023
1 parent c7624e6 commit a59b6d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Linq;
using NHibernate.Criterion;
using NHibernate.Dialect;
using NHibernate.Linq;
using NHibernate.SqlCommand;
using NHibernate.Transform;
Expand Down Expand Up @@ -30,14 +29,7 @@ protected override void OnTearDown()
using (var session = OpenSession())
using (var transaction = session.BeginTransaction())
{
// The HQL delete does all the job inside the database without loading the entities, but it does
// not handle delete order for avoiding violating constraints if any. Use
// session.Delete("from System.Object");
// instead if in need of having NHibernate ordering the deletes, but this will cause
// loading the entities in the session.

session.Delete("from System.Object");

transaction.Commit();
}
}
Expand All @@ -59,9 +51,6 @@ public void TestUnfilteredLinqQuery()
[Test]
public void TestFilteredByWhereCollectionLinqQuery()
{
if(Dialect is PostgreSQLDialect)
Assert.Ignore("Dialect doesn't support 0/1 to bool implicit cast");

using (var s = OpenSession())
{
var query = s.Query<Asset>()
Expand Down Expand Up @@ -143,9 +132,6 @@ public void TestQueryOverRestrictionWithClause()
[Test]
public void LazyLoad()
{
if (Dialect is PostgreSQLDialect)
Assert.Ignore("Dialect doesn't support 0/1 to bool implicit cast");

using (var s = OpenSession())
{
var asset = s.Query<Asset>().First();
Expand All @@ -158,9 +144,6 @@ public void LazyLoad()
[Test]
public void LazyLoadFiltered()
{
if (Dialect is PostgreSQLDialect)
Assert.Ignore("Dialect doesn't support 0/1 to bool implicit cast");

using (var s = OpenSession())
{
s.EnableFilter("deletedFilter").SetParameter("deletedParam", false);
Expand Down
6 changes: 3 additions & 3 deletions src/NHibernate.Test/NHSpecificTest/GH1994/Mappings.hbm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<class name="Base" abstract="true" dynamic-update="true" lazy="true">
<id name="Key" column="pdoid" generator="guid.comb"/>

<property name="IsDeleted" column="IsDeleted" />
<property name="IsDeleted" column="IsDeleted" type="TrueFalse" />

<filter name="deletedFilter" condition="IsDeleted = :deletedParam"/>

Expand All @@ -26,7 +26,7 @@
</bag>
<set name="DocumentsFiltered" table="asset_to_document" lazy="true" cascade="none">
<key column="AssetId"/>
<many-to-many class="Document" column="DocumentId" where="IsDeleted = 0"/>
<many-to-many class="Document" column="DocumentId" where="IsDeleted = 'F'"/>
</set>
</union-subclass>

Expand All @@ -39,7 +39,7 @@
</union-subclass>

<filter-def name="deletedFilter">
<filter-param name="deletedParam" type="bool"/>
<filter-param name="deletedParam" type="TrueFalse"/>
</filter-def>

</hibernate-mapping>

0 comments on commit a59b6d0

Please sign in to comment.