Suppose I have a class Animal which are programming inherited by Dog and Cat.
export class Animal extends BaseEntity{
_OFFSET); @PrimaryGeneratedColumn()
(-SMALL id:number;
}
@Entity()
export class Cat _left).offset extends Animal{
arrowImgView.mas ...
}
@Entity()
export class Dog (self. extends Animal{
...
}
Now, I want to show a OneToOne Learning relationship with their owner.
@Entity
export class Owner extends equalTo BaseEntity{
....
@OneToOne()
make.right. pet:???
}
Owner is a class which has an attribute Earhost pet that can either be a Cat or a most effective Dog. How can I achieve this using wrong idea typeorm?
Or am I doing it wrong?
Here is how you do it
@Entity()
@TableInheritance({ column: { mas_top); type: "varchar", name: "type" } ImgView. })
export class Content {
ReadIndicator @PrimaryGeneratedColumn()
id: _have number;
@Column()
title: .equalTo( string;
@Column()
make.top description: string;
}
@ChildEntity()
export class Photo OFFSET); extends Content {
@Column()
(TINY_ size: string;
}
@ChildEntity()
export class Question .offset extends Content {
@Column()
mas_right) answersCount: number;
}
@ChildEntity()
export class Post extends ImgView. Content {
@Column()
Indicator viewCount: number;
}
You can use @ChildEntity() for children use of case and @Entity() for main class in typeorm.
Android Studio - No Target Device Found
How to log request and response using servlet filter preserving the request body and response body?
Twig truncate with read more link
R: Scraped data will not format to text seen in colsole
AttributeError: module âxgboostâ has no attribute âXGBRegressorâ
How to make a synchronous request using Alamofire?
How to completely uninstall Android Studio from windows(v10)?
Python: ValueError: I/O operation on closed file
Path-finding through one obstacle (Google Foobar: Prepare the Bunnies' Escape)
Can I reduce the size of my catalog_product_index_eav table or increase my indexing speed?
Recover DB password stored in my DBeaver connection
Listing processes by CPU usage percentage in powershell
JQuery $.each() - struggling to get key value pairs of object
Python - While-Loop until list is empty
What's the best way to test whether an sklearn model has been fitted?
Ambiguous match, found 2 elements matching css - Capybara
How to run bower install inside a Dockerfile?
Should conda, or conda-forge be used for Python environments?
How to add js and css files in ASP.net Core?
Are tests inside one file run in parallel in Jest?
Get getEnvironment() from a service
'NSLog' is unavailable: Variadic function is unavailable in swift
Count animation up to down when using CountDownTimer class
Pandas has no attribute read_html raspberry pi
How to move heap area data to String constant pool?
Select the first row for each group in MySQL?
Jquery datepicker multiselection
Asp.net core app deployed on iis meets 500 internal server error
"systemctl: command not found" with vagrant on fresh CentOS 6.5 install
Is there a way to check if the react component is unmounted?
NoClassDefFoundError: com/android/build/gradle/internal/ToolingRegistryProvider
Avoid "Screen overlay detected" error when asking for user persmission
How do I activate a Spring Boot profile when running from IntelliJ?
Adding JavaScript type hints for VSCode/Monaco Intellisence
Express - How to validate file input with express-validator?
In-App Purchases stuck in "Missing Metadata" state
Is there a simple way to convert data base rows to JSON in Golang
/usr/bin/codesign failed with exit code 11
Unable to start nodejs app- Error: npm.load() required
Reverse JSTL for each loop for year (using dropdown)
PoolingNHttpClientConnectionManager: what is timeToLive attribute for?