fixed issue in qb

This commit is contained in:
Umed Khudoiberdiev 2016-05-24 00:30:50 +05:00
parent 50650faa7f
commit 576cced2e8
3 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{
"name": "typeorm",
"private": true,
"version": "0.0.2-alpha.27",
"version": "0.0.2-alpha.28",
"description": "Data-mapper ORM for Typescript",
"license": "Apache-2.0",
"readmeFilename": "README.md",

View File

@ -665,7 +665,7 @@ export class QueryBuilder<Entity> {
} else if (relation.isOneToMany || (relation.isOneToOne && !relation.isOwning)) {
const joinTableColumn = relation.inverseRelation.joinColumn.referencedColumn.name;
const condition = join.alias.name + "." + relation.inverseSideProperty + "=" + parentAlias + "." + joinTableColumn;
const condition = join.alias.name + "." + relation.inverseRelation.name + "=" + parentAlias + "." + joinTableColumn;
return " " + joinType + " JOIN " + joinTableName + " " + join.alias.name + " " + join.conditionType + " " + condition + appendedCondition;
} else {

View File

@ -98,7 +98,7 @@ describe("persistence > custom-column-names", function() {
// load a post
before(function() {
return postRepository
.findOneById(1, { alias: "post", leftJoinAndSelect: { category: "post.categoryId" } })
.findOneById(1, { alias: "post", leftJoinAndSelect: { category: "post.category" } })
.then(post => loadedPost = post);
});
@ -133,7 +133,7 @@ describe("persistence > custom-column-names", function() {
// load a post
before(function() {
return postRepository
.findOneById(1, { alias: "post", leftJoinAndSelect: { category: "post.categoryId" } })
.findOneById(1, { alias: "post", leftJoinAndSelect: { category: "post.category" } })
.then(post => loadedPost = post);
});
@ -163,7 +163,7 @@ describe("persistence > custom-column-names", function() {
// load a post
before(function() {
return postRepository
.findOneById(1, { alias: "post", leftJoinAndSelect: { category: "post.categoryId" } })
.findOneById(1, { alias: "post", leftJoinAndSelect: { category: "post.category" } })
.then(post => loadedPost = post);
});
@ -211,7 +211,7 @@ describe("persistence > custom-column-names", function() {
// load a post
before(function() {
return postRepository
.findOneById(1, { alias: "post", leftJoinAndSelect: { category: "post.categoryId", metadata: "category.metadataId" } })
.findOneById(1, { alias: "post", leftJoinAndSelect: { category: "post.category", metadata: "category.metadata" } })
.then(post => loadedPost = post);
});
@ -256,7 +256,7 @@ describe("persistence > custom-column-names", function() {
// load a post
before(function() {
return postRepository
.findOneById(1, { alias: "post", leftJoinAndSelect: { category: "post.categoryId", metadata: "category.metadataId" } })
.findOneById(1, { alias: "post", leftJoinAndSelect: { category: "post.category", metadata: "category.metadata" } })
.then(post => loadedPost = post);
});