<commit_before>using System.Collections;
using NHibernate.Hql.Ast.ANTLR;
using NUnit.Framework;

namespace NHibernate.Test.HQL.Ast
{
	[TestFixture, Ignore("Not suported yet.")]
	public class WithClauseFixture : BaseFixture
	{
		public ISession OpenNewSession()
		{
			return OpenSession();
		}

		[Test]
		public void WithClauseFailsWithFetch()
		{
			var data = new TestData(this);
			data.Prepare();

			ISession s = OpenSession();
			ITransaction txn = s.BeginTransaction();

			Assert.Throws<HibernateException>(
				() =>
				s.CreateQuery("from Animal a inner join fetch a.offspring as o with o.bodyWeight = :someLimit").SetDouble(
					"someLimit", 1).List(), "ad-hoc on clause allowed with fetched association");

			txn.Commit();
			s.Close();

			data.Cleanup();
		}

		[Test]
		public void InvalidWithSemantics()
		{
			ISession s = OpenSession();
			ITransaction txn = s.BeginTransaction();

			// PROBLEM : f.bodyWeight is a reference to a column on the Animal table; however, the 'f'
			// alias relates to the Human.friends collection which the aonther Human entity.  The issue
			// here is the way JoinSequence and Joinable (the persister) interact to generate the
			// joins relating to the sublcass/superclass tables
			Assert.Throws<InvalidWithClauseException>(
				() =>
				s.CreateQuery("from Human h inner join h.friends as f with f.bodyWeight < :someLimit").SetDouble("someLimit", 1).
					List());

			Assert.Throws<InvalidWithClauseException>(
				() =>
				s.CreateQuery(
					"from Animal a inner join a.offspring o inner join o.mother as m inner join m.father as f with o.bodyWeight > 1").
					List());

			Assert.Throws<InvalidWithClauseException>(<commit_msg>With clause on air<commit_after>using System.Collections;
using NHibernate.Hql.Ast.ANTLR;
using NUnit.Framework;

namespace NHibernate.Test.HQL.Ast
{
	[TestFixture]
	public class WithClauseFixture : BaseFixture
	{
		public ISession OpenNewSession()
		{
			return OpenSession();
		}

		[Test]
		public void WithClauseFailsWithFetch()
		{
			var data = new TestData(this);
			data.Prepare();

			ISession s = OpenSession();
			ITransaction txn = s.BeginTransaction();

			Assert.Throws<SemanticException>(
			  () =>
				s.CreateQuery("from Animal a inner join fetch a.offspring as o with o.bodyWeight = :someLimit").SetDouble(
					"someLimit", 1).List(), "ad-hoc on clause allowed with fetched association");

			txn.Commit();
			s.Close();

			data.Cleanup();
		}

		[Test]
		public void InvalidWithSemantics()
		{
			ISession s = OpenSession();
			ITransaction txn = s.BeginTransaction();

			// PROBLEM : f.bodyWeight is a reference to a column on the Animal table; however, the 'f'
			// alias relates to the Human.friends collection which the aonther Human entity.  The issue
			// here is the way JoinSequence and Joinable (the persister) interact to generate the
			// joins relating to the sublcass/superclass tables
			Assert.Throws<InvalidWithClauseException>(
				() =>
				s.CreateQuery("from Human h inner join h.friends as f with f.bodyWeight < :someLimit").SetDouble("someLimit", 1).
					List());

			Assert.Throws<InvalidWithClauseException>(
				() =>
				s.CreateQuery(
					"from Animal a inner join a.offspring o inner join o.mother as m inner join m.father as f with o.bodyWeight > 1").
					List());

			Assert.Throws<InvalidWithClauseException>(
{'fraction_non_alphanumeric': 0.10945865556216537, 'fraction_numerical': 0.001784651992861392, 'mean_word_length': 3.6386206896551725, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4662557', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1014, 'n_words': 311}