Questions tagged [table-per-hierarchy]

A technique that maps an inheritance hierarchy of objects to a single table in relational database.

133 questions
0
votes
1 answer

Discriminator as NUll when insert Data in Base class using TPH

I have a table Master Id Tag Text Discriminator Data in it is like …
0
votes
1 answer

Prevent cyclic parent_ID `table per type` vs `table per hierarchy` vs `table per class`

I am using Table Per Hierarchy TPH in Entity Framework, which is basically a partial class for common core attributes to the extended data types. I have 2 Objects/Classes; Course Object and a Student Object which share the same base properties as…
0
votes
2 answers

How to map inheritance with property returned other inheritance?

I have abstract class Vehicle and two classes that derive from: Car and ForkLift. public abstract class Vehicle { public EngineBase Engine { get; set; } } public class Car : Vehicle { public GasEngine Engine { get; set; } } public class…
dariol
  • 1,959
  • 17
  • 26
0
votes
1 answer

Entity Framework Code First TPH Discriminator Column

I'm using Entity Framework 6.0 with Code First and Table per Hierarchy (TPH) inheritance. See the following MWE (I omit the other fluent api statements to clarify where the problem is): public abstract class Employee { public int EmployeeId {…
user2653422
  • 1,095
  • 1
  • 12
  • 18
0
votes
0 answers

EntityFramework Table Per Hierarchy query for multiple discriminators

Here is the scenario - We have an application that supports posting to multiple social sites (Facebook, Twitter, G+, etc). We used TPH to structure this, all in one Posts table, with a discriminator column. Each of these "Social" posts derives…
0
votes
1 answer

nHibernate - is there a way to debug TPH objects creation?

I have a table-per-hierarchy structure mapped by code, and a table with data - 116 rows. Initially this table (and a whole database) was created using Entity Framework Code First approach. Due to some reasons I am switching from EF to NH, and…
DarkDeny
  • 1,750
  • 2
  • 21
  • 31
0
votes
2 answers

Table per Hierarchy table mapping with both shared and unshared columns

This is an extension of this question which from what I can tell now works in EF6. However, it seems as though there's a problem when you've got subclasses which have both shared and unshared properties. Let's say this is my model setup: public…
0
votes
1 answer

Entity Framework 6 Table per Hierarchy (TPH) bug

I've created an abstract class with some base properties: public abstract class BaseModel { public BaseWishModel() { } [Key] public int Id { get; set; } public virtual string Title { get; set; } public bool IsPublished…
Arnold
  • 89
  • 1
  • 11
0
votes
1 answer

how should I implement table per hierarchy entity into views

i have implemented table-per-hierarchy pattern into one of my entities and it looks like this: atm, sube and acikhava entities are basically derived from mekan entity. there is no problem with these. well, what i want to know is, how should i…
Batu
  • 431
  • 1
  • 6
  • 17
0
votes
1 answer

how to make tablePerHierarchy false and use discriminator?

A question like what I need is asked here but it's answer is not satisfying what I need. I have classes like this : abstract class A{ String a } class B extends A{ String b } class C extends A{ String c } I want to have a table for each…
Lrrr
  • 4,755
  • 5
  • 41
  • 63
0
votes
1 answer

What's the proper way to model this relationship in ERD and EF?

I'm designing a brand new DB model for a new system. My goal is to have it be stored in SQL and mapped into objects by Entity Framework. I'm heavily using Table-per-Hierarchy pattern in order to support a complex object hierarchy and have it be…
Igorek
  • 15,716
  • 3
  • 54
  • 92
0
votes
1 answer

GRAILS: Using Domain subclasses

Using Grails with the following versions: APPLICATION STATUS App version: 0.1 Grails version: 2.3.5 Groovy version: 2.1.9 JVM version: 1.7.0_51 Reloading active: true Controllers: 15 Domains: 18 Services: 2 Tag Libraries: 13 I have a domain model…
Marque
  • 1
  • 2
0
votes
1 answer

How to get all objects of concrete class in table-per-hierarchy with hibernate?

I'm developing a web application with Netbeans (Maven Web Application) using Spring MVC and Hibernate. I have an abstract class (User) with multiple concrete classes (Parent, Child, etc.). I chose for a table-per-hierarchy construction so that I…
0
votes
1 answer

Unable set table mapping to Boolean = False

I am trying to set an inheritance in Entity-Framework, I want to set the mapping when BooleanColumn = True. I am unable to do so.
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
0
votes
0 answers

Entity Framework: One to one issue in TPC hierarchy

I have a TPC hierarchy like this: public abstract class Base { public Guid BaseId { get; set; } public string BaseName { get; set; } } public class Sub1 : Base { public Sub2 Vender { get; set; } } public class Sub2 : Base { …
Lcng
  • 706
  • 1
  • 8
  • 17
1 2 3
8
9
Id Tag Text Discriminartor