Note that there are some explanatory texts on larger screens.

plurals
  1. POOne to Many relationship using breezejs
    primarykey
    data
    text
    <p>I have the following one to many relationship setup between two tables (Case and Recipient)</p> <p>Case table has one primary key which is identified as an identity (auto-increment) tblRecipient has one primary key which is identified as an identity (auto-increment),and a foreign key relationship with Case. <img src="https://i.stack.imgur.com/qnY8R.png" alt="One To Many"></p> <p>Case table and related tblRecipient data is pulled:</p> <pre><code>function searchCases(caseID, caseNum) { var qPredicate; if (caseID != '') { qPredicate = new breeze.Predicate("pkCaseID", "==", parseInt(caseID)); } else if (caseNum != null) { qPredicate = new breeze.Predicate("CaseNumber", "Contains", caseNum); } var query = breeze.EntityQuery .from("case") .where(qPredicate) .expand("tblRecipients") return manager.executeQuery(query); } </code></pre> <p>When a button is pressed to add a new recipient, the following code is used to create a new recipient entity:</p> <pre><code> function createNewRecipient(CaseID) { var recipientEntityType = manager.metadataStore.getEntityType("tblRecipient"); var newRecipient = manager.createEntity(recipientEntityType, {fkCaseID: CaseID}); return newRecipient; } </code></pre> <p>This code returns this error: <strong>Error: Cannot attach an object to an EntityManager without first setting its key or setting its entityType 'AutoGeneratedKeyType' property to something other than 'None'</strong></p> <p><img src="https://i.stack.imgur.com/YI2JG.png" alt="enter image description here"></p> <p><em>The AutoGeneratedKeyType in the metadata shows None instead of Identity as in the Case table. We are not sure what we need to change or how to really debug this. Any help would be appreciated.</em></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload