Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5930061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:30:21+00:00 2026-05-22T14:30:21+00:00

I have the following modeling problem in Core Data. A Student can take Lessons.

  • 0

I have the following modeling problem in Core Data. A Student can take Lessons.
A Lesson has the following fields:

title
date
grade
type

A Lesson can be one of three types:

lessontype1:

subtype11 subtype12 subtype13

lessontype2:

subtype21 subtype22 subtype23 subtype24

lessontype3:

 subtype31 subtype32 subtype33 subtype34 subtype35

How do I set the lesson.type to any of these three types of Lessons? Is there a better way to model this scenario?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:30:22+00:00Added an answer on May 22, 2026 at 2:30 pm

    The details of your model depend on details of the data you are modeling.

    If the types are just markers that have no logic or behavior associated with them, then the simplest model would be:

    Student{
        lessons<-->>Lesson.student
    }
    
    Lesson{
        title:string
        date:date
        grade:number
        type:string
        subtype:string
        student<<-->Student.lessons
    }
    

    If the lessons have some kind of behavior associated with each type, then you could create subentities for each type of lesson.

    Lesson{
        title:string
        date:date
        grade:number
        student<<-->Student.lessons
    }
    
    TypeOne:Lesson{
    
    }
    
    TypeOneSubOne:TypeOne{
    
    }
    
    // ...etc
    

    Since all the Lesson subentities inherit from Lesson, they can inherit the relationship as well. All the different subentities can be in the Student.lesson relationship.

    If the types of lessons have behaviors associated with them, you can break them out into separate entities as well.

    Lesson{
        title:string
        date:date
        grade:number
        type<<-->Type.lessons
        student<<-->Student.lessons
    }
    
    Type{
        lessons<-->>Lesson.type
    }
    
    TypeOne:Type{
    
    }
    
    TypeOneSubOne:TypeOne{
    
    }
    

    A Core Data model is intended to simulate real-world objects, events or conditions and the relationships between them. The first step in designing a model is to understand those real-world things and the relationships between them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following structure, and as you can see the methods data is
I'm having a problem modelling the following problem in JPA. I have a JPA
I have the following problem in application architecture and am willing to solve it
I have the following in mind: A product can have multiple categories A category
Is there a proper term in data modeling to describe the following? Given table
Preface: I don't have experience with rules engines, building rules, modeling rules, implementing data
When I asked about the right approach to a data modeling problem--using one or
Background: I have a class modeling a chip with registers, the chip has a
I have the following simple problem that I'd like to use to experiment with
I have a question about DB modeling, I have a table created as following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.