简体   繁体   中英

Inheritance between persisted models in loopback

I'm actually trying to use loopback, and I wonder if it's possible to define a complex model architecture using inheritance like we can do with Hibernate ( Chapter 9. Inheritance mapping ).

For example, how can I define an abstract class Vehicle , a class Car that extends Vehicle and a class Truck that extends Vehicle too ?

Thank you

Actually, after some researches, if you use an sql database there is some posibilities :

  • create those models in loopback
  • create those tables in postgresql (for example)
  • create a view in postgres that make wrapping of everything
  • create a model in loopback binded to sql view

Several avantages

  • Inheritance mapping working
  • Better performances than the loopback embedded orm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM