Questions tagged [multi-table-inheritance]

52 questions
2
votes
1 answer

Rails Multi inheritance on database level

I would like to implement something along the lines of multi table inheritance for my rails application. I am familiar with how STI works and was wondering if the implementation would be similar. My situation is as follows (names of tables have…
2
votes
1 answer

@NaturalId only valid on root entity (or its @MappedSuperclasses), using Natural Id in Joined, Multiple Table Inheritance

basically I cant find in google some similar problems by just pasting the root exception "@NaturalId only valid on root entity (or its @MappedSuperclasses)" in the search tab. I'm using a Joined, Multiple Table inheritance strategy to map my…
2
votes
2 answers

Inherit from non-abstract model without multi-table inheritance

Is there a way to inherit from an existing model in order to copy of all its fields (in a DRY manner) without invoking multitable inheritance if the model isn't abstract? To be clear, I have a model Post, and I'd like to have another model GhostPost…
jdotjdot
  • 16,134
  • 13
  • 66
  • 118
2
votes
1 answer

how to copy an object using multi table inheritance in django

I am trying to copy an object that extends another object through multi table inheritance. The parent is Group and the child is Location The problem is that the parent object is changed instead of creating a new parent and child object. Here is what…
Atma
  • 29,141
  • 56
  • 198
  • 299
2
votes
1 answer

django: Downcasting automatically in multitable inheritance/polymorphic tables

I have something like this: class Base(Model): ... def downcast(self): try: return self.childa except: pass try: return self.childb except: pass …
rrauenza
  • 6,285
  • 4
  • 32
  • 57
2
votes
1 answer

Django multi-table inheritance chokes on leaked variable in model definition

class Parent(models.Model): pass class RebelliousChild(Parent): parent_fields = [__x.name for __x in Parent._meta._fields()] Django 1.3 responds: django.core.exceptions.FieldError: Local field '_RebelliousChild__x' in class…
2
votes
1 answer

Rails - Citier - Two level inheritance, Child Class don't inherit Middle Class attributes

I'm trying to implement a structure like: GrandFather <- Father <- Son Using rails and the gem citier. This example should create 2 tables to represent the 3 classes: one for the Root class (GrandFather) and it's attributes and other to represent…
Gus
  • 942
  • 9
  • 32
1
vote
1 answer

Django multi-table inheritance - make sure only one child exists (CheckConstraint)

How can I make sure that a parent object has only one child/type? class Property(...): class Meta: abstract = False class Flat(Property): pass class House(Property): pass class Land(Property): pass I want every property…
Milano
  • 18,048
  • 37
  • 153
  • 353
1
vote
2 answers

4 tables insert - mysql

I want to insert by selecting @DistName and @ProvName from district and province INSERT INTO users VALUES ( '@UserName', '@email', '@Pass', '@Status', '@phoneNo', '@VillName', '@DistName', '@ProvName' );
Siph
  • 11
  • 1
1
vote
0 answers

ActiveRecord::ActsAs routing problems

Upgrading an old Rails 3 app to Rails 4, multiple table inheritance gem has been changed due to deprecation. Now, using ActsAs. Nested routes are not working producing following error: undefined method `vehicle_path' for…
1
vote
2 answers

Django - How can I get a child type object from a parent class object using MTI?

I have a function, get_priority(), which sorts through all objects in a parent class (Chunk) to get the highest 'priority' object. Now I want to get the related subclass object to the superclass object. The Django docs on Multi-Table Inheritance…
Era
  • 171
  • 1
  • 5
  • 13
1
vote
0 answers

Doctrine 2.5.4 discriminator issue with postgres camelCased column name: "The discriminator column "" is missing for "" using the DQL alias "r"

So I was working with doctrine multiple class table inheritance with an existing database. When I tried to query it throws The discriminator column "customertype" is missing for "Entity\Customer" using the DQL alias "r". The current entity setup…
1
vote
1 answer

django multi-table inheritance, access method from child from instance of parent

I am using Multi-Table inheritance (aka Concrete Inheritance), where I have a non-abstract model + DB Table called Clients, which is concerned with common details concerning all the clients. But a client can be an Individual, Partnership or Company,…
1
vote
1 answer

how to get parent object in multi table inheritance in django

I have the following two models that use multi table inheritance. PlayerAchievment extends OverallAchievment: class OverallAchievment(models.Model): achievement = models.ForeignKey(Achievement) match = models.ForeignKey(Match,…
Atma
  • 29,141
  • 56
  • 198
  • 299
1
vote
0 answers

Django multi table inheritance creating parents

If, for example, I have the following: class User(models.Model): school = models.ForeignKey(School) email = models.EmailField(max_length=254) password = models.CharField(max_length=32) name = models.CharField(max_length=50) class…
Pictraz
  • 159
  • 1
  • 1
  • 9