Oracle Connector - Model Creation Best Practice

14 vistas
Ir al primer mensaje no leído

Gm Mkr

no leída,
22 ago 2017, 2:09:40 a.m.22/8/17
para loopb...@googlegroups.com
I have a relation schema in oracle as above

    Table: tBook, BookId,BookName,BookDesc
    Table: tCategory, CategoryId,CategoryName,CategoryDesc
    Table: tBookCat , BookId, CatergoryId,Price

StrongLoop Models created for each of the above tables.
Now i need to retrieve tBookCat object by Book Name and CategoryName.
I am stuck here as creating relation ship here across 2 models and retrieve the 3 model.
Should i created a new flat combined model and use native sql?
Any inputs will be greatly appreciated here

My intention is to perform this without making three calls.

    select tBookCat.Price, a.CategoryDesc, b.BookDesc ,a.CategoryId,b.BookId
    from
    tBookCat , tCategory a , tBook b
    where tBookCat.CategoryId = a.CategoryId and tBookCat.BookId = b.BookId
    where a.CategoryName = 'learn" and b.BookName='StrongLoop'

can i avoid making the below 3 calls

 1. Book.FindOne by Name 
 2. Category.FindOne By Name
 3. BookCategory.FindOne by CategoryName and BookName

How should i create my model. currently i have created model referrin to tBook, tCategory and tBookCat. 
What is the right approach.
Any help would be greatly appreciated
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos