For a better structure, I want to split a more complex table in two entitys which results in two classes. By specifying a One-to-One-Relation, I would expect from a ORM that both were provided in the same table - Cause Joins make no sense here in a 1:1 relation and only affect performance.
So I've the following entities:
@Entity()
export class A {
@PrimaryColumn() id: number
// Other Properties
@OneToOne(type => B)
b: B
}
@Entity()
export class B {
@Colum()
someOtherProperty: number
}
But this doesn't work, I got an error that B has no primary key. If I specify a primary key (which makes no sense), I have two tables A
and B
. The documentation only describes 1:1 relations with two tables.
So why they build a unnecessary second table here? I used other powerful ORMs like EntityFramework, where this is the default behavior on 1:1 relations. Additional tables are only generated there when needed (1:n, n:n relations).