title: Typeorm BaseEntity create function: how to deeply create an entity?
body: <p>I have a Patient entity: </p>
  
  <pre><code>@Entity()
  @ObjectType()
  @InputType('PatientInput')
  export class Patient extends BaseEntity {
   @PrimaryGeneratedColumn()
   @Field(type =&gt; Int, { nullable: true })
   id: number
  
   @Column({ length: 500 })
   @Field({ nullable: true })
   firstName?: string
  
   @Column({ length: 500 })
   @Field({ nullable: true })
   lastName?: string
  
   @Field(type =&gt; MedicalCondition, { nullable: true })
    @OneToMany(type =&gt; MedicalCondition, medicalCondition =&gt; medicalCondition.patient, { cascade: true })
    medicalConditions?: MedicalCondition[]
  }
  </code></pre>
  
  <p>And a MedicalCondition entity: </p>
  
  <pre><code>@ObjectType()
  @Entity()
  @InputType('medicalCondition')
  export class MedicalCondition extends BaseEntity {
    @Field({nullable: true})
    @PrimaryGeneratedColumn()
    id: number
  
    @Field(type =&gt; Int, { nullable: true })
    @RelationId((medicalCondition: MedicalCondition) =&gt; medicalCondition.patient)
    @Column()
    patientId?: number
  
    @Field(type =&gt; Patient, { nullable: true })
    @ManyToOne(type =&gt; Patient, patient =&gt; patient.medicalConditions, {
      onDelete: 'CASCADE',
    })
    @JoinColumn()
    patient?: Patient
  
    @Field()
    @Column()
    name: string
  
    @Field({nullable: true})
    @Column()
    startDate?: Date
  }
  </code></pre>
  
  <p>When trying to create an instance of patient using the BaseEntity create function, the patient is created but in the medical conditions array only containes the last element and all the rest disappear even if there were many elements.</p>
  
  <pre><code>@Mutation(returns =&gt; Patient)
    async create(@Args('patient') newPatientInput: Patient, @CurrentUser() user: User, @Useragent() useragent): Promise&lt;Patient&gt; {
      const newPatient: Patient = Patient.create(newPatientInput)
      const event = createEvent({ useragent, actionType: 'add_patient', userId: user.id })
      const p = await this.patientService.create(newPatient, event)
      return p
    }
  </code></pre>
  
  <pre><code>create = async (patient: Patient, event: EventLog): Promise&lt;Patient&gt; =&gt; {
      const isExist = await this.isPatientExist({ firstName: patient.firstName, lastName: patient.lastName, birthDate: patient.birthDate })
  
      if (isExist &gt; 0) {
        throw new Error('Patient already exist')
      } else {
        const transactionResult = runTransaction(async (em) =&gt; {
          const eventLog = EventLog.create(event)
          await em.save(eventLog)
          return await em.save(patient)
        })
        return transactionResult
      }
    }
  
  </code></pre>
  
  <p>I tried to directly save the entity without invoting <code>create()</code>:</p>
  
  <pre><code>     return await em.save(Patient, patient)
  </code></pre>
  
  <p>and that was the result of the saving: </p>
  
  <pre><code> medicalConditions:
     [ { id: 36,
         name: 'heartDisease',
         startDate: 2016-07-31T21:00:00.000Z,
         kin: 'father',
         note: '',
         patientId: 26,
         createdAt: 2019-11-24T17:11:22.376Z,
         updatedAt: 2019-11-24T17:11:22.376Z },
       { id: null,
         name: 'previousHeartAttack',
         startDate: 2018-04-30T21:00:00.000Z,
         kin: 'brother',
         note: '' },
       { id: null,
         name: 'highBloodPressure',
         startDate: 2018-03-31T21:00:00.000Z,
         kin: 'sister',
         note: '' } ],
  
  </code></pre>
  
  <p>Tried google for it and didn't find any known issue.</p>
  
  <p>So the willing result would be to create an entity deeply, is that a possible behavior?</p>