-
Notifications
You must be signed in to change notification settings - Fork 934
Test Case for Invalid SQL with property-ref on property using a formula #3309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fredericDelaporte
merged 10 commits into
nhibernate:master
from
PapisKang:GH3513-many-to-one-targetting-formula
Feb 6, 2024
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
850e811
GH3513 : Creating Test Case When a many-to-one relationship with a pr…
PapisKang 740f11a
Generate async files
github-actions[bot] a9dd58f
GH-3513 : Reporting the original test case for this issue
PapisKang 8f4078a
Merge branch 'GH3513-many-to-one-targetting-formula' of https://githu…
PapisKang 010c148
Generate async files
github-actions[bot] fd5eadb
GH-1313 : Moving the test case from GH3513 to GH1313 according to htt…
PapisKang eec4eb0
Generate async files
github-actions[bot] cc05308
Merge branch 'master' into GH3513-many-to-one-targetting-formula
fredericDelaporte 2bc48bc
Modernize syntax and mark test as explicit
fredericDelaporte 49a1b71
Merge branch 'master' into GH3513-many-to-one-targetting-formula
fredericDelaporte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
src/NHibernate.Test/Async/NHSpecificTest/GH1313/Fixture.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by AsyncGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
|
||
using System; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using NHibernate.Linq; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.GH1313 | ||
{ | ||
using System.Threading.Tasks; | ||
[TestFixture] | ||
public class FixtureAsync : BugTestCase | ||
{ | ||
protected override void OnSetUp() | ||
{ | ||
using var session = OpenSession(); | ||
using var transaction = session.BeginTransaction(); | ||
|
||
var account = new Account { Id = 1, Name = "Account_1", OldAccountNumber = 1 }; | ||
var order = new HoldClose | ||
{ | ||
Account = account, | ||
CloseDate = new DateTime(2023, 1, 1) | ||
}; | ||
|
||
session.Save(account); | ||
session.Save(order); | ||
transaction.Commit(); | ||
} | ||
|
||
protected override void OnTearDown() | ||
{ | ||
using var session = OpenSession(); | ||
using var transaction = session.BeginTransaction(); | ||
|
||
session.CreateQuery("delete from System.Object").ExecuteUpdate(); | ||
transaction.Commit(); | ||
} | ||
|
||
[Test] | ||
[Explicit("Not fixed yet")] | ||
public async Task ManyToOneTargettingAFormulaAsync() | ||
{ | ||
using var session = OpenSession(); | ||
using var transaction = session.BeginTransaction(); | ||
|
||
var result = session.Query<HoldClose>(); | ||
|
||
Assert.That(await (result.ToListAsync()), Has.Count.EqualTo(1)); | ||
await (transaction.CommitAsync()); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace NHibernate.Test.NHSpecificTest.GH1313 | ||
{ | ||
public class Account | ||
{ | ||
public virtual int Id { get; set; } | ||
public virtual string Name { get; set; } | ||
public virtual int OldAccountNumber { get; set; } | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.GH1313 | ||
{ | ||
[TestFixture] | ||
public class Fixture : BugTestCase | ||
{ | ||
protected override void OnSetUp() | ||
{ | ||
using var session = OpenSession(); | ||
using var transaction = session.BeginTransaction(); | ||
|
||
var account = new Account { Id = 1, Name = "Account_1", OldAccountNumber = 1 }; | ||
var order = new HoldClose | ||
{ | ||
Account = account, | ||
CloseDate = new DateTime(2023, 1, 1) | ||
}; | ||
|
||
session.Save(account); | ||
session.Save(order); | ||
transaction.Commit(); | ||
} | ||
|
||
protected override void OnTearDown() | ||
{ | ||
using var session = OpenSession(); | ||
using var transaction = session.BeginTransaction(); | ||
|
||
session.CreateQuery("delete from System.Object").ExecuteUpdate(); | ||
transaction.Commit(); | ||
} | ||
|
||
[Test] | ||
[Explicit("Not fixed yet")] | ||
public void ManyToOneTargettingAFormula() | ||
{ | ||
using var session = OpenSession(); | ||
using var transaction = session.BeginTransaction(); | ||
|
||
var result = session.Query<HoldClose>(); | ||
|
||
Assert.That(result.ToList(), Has.Count.EqualTo(1)); | ||
transaction.Commit(); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.GH1313 | ||
{ | ||
public class HoldClose | ||
{ | ||
public virtual int Id { get; set; } | ||
public virtual Account Account { get; set; } | ||
public virtual DateTime CloseDate { get; set; } | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/NHibernate.Test/NHSpecificTest/GH1313/Mappings.hbm.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernate.Test" | ||
namespace="NHibernate.Test.NHSpecificTest.GH1313"> | ||
|
||
<class name="HoldClose" > | ||
<id name="Id" generator="native"/> | ||
<many-to-one name="Account" class="Account" column="accountnumber" property-ref="OldAccountNumber"/> | ||
<property name="CloseDate" /> | ||
</class> | ||
<class name="Account" > | ||
<id name="Id" generator="assigned"/> | ||
<property name="Name"/> | ||
<property name="OldAccountNumber" insert="false" update="false" generated="never" > | ||
<formula>convert(int,substring([Oldaccountnumber],3,8))</formula> | ||
</property> | ||
</class> | ||
|
||
</hibernate-mapping> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is not fixed yet, marking as explicit allows the test case to be ignored by the CI. This will have to be removed once the trouble is fixed.