How do I use "ForeignKey" and "LinkTable" property attributes in Database Toolbox's ORM functionality in MATLAB R2024b?

I am trying to use the features of ORM that were released in MATLAB R2024b. There are two new properties "LinkTable" and "ForeignKey" that I want to use but there are no sufficient examples I could find in the documentation. What is the syntax I need to follow to add these properties to my ORM classes ?

 Accepted Answer

"ForeignKey" and "LinkTable" are two new property attributes added to Database Toolbox's ORM functionality. Please refer to the files attached to this article that demonstrate a simple use-case describing Link Tables and Foreign Key.
To implement "LinkTable" please refer to: 
  1. "Address.m"
  2. "Customer.m"
  3. "LinkTableExample.mlx"
To implement "ForeignKey" refer to: 
  1. "Book.m"
  2. "Person.m"
  3. "ORMForeignKeyExample.mlx"
The M files define the relationship between the classes using the "LinkTable" and "ForeignKey" attributes respectively while the live scripts show a quick demo of creating the objects, writing them out to the database, and reading the objects back into MATLAB. 

More Answers (0)

Products

Release

R2024b

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!