discriminator « Map « JPA Q&A





1. Hibernate mappings with a discriminator    stackoverflow.com

I have a table with one field that can point to a foreign key in one of 3 other tables based on what the descriminator value is (Project, TimeKeep, or CostCenter. ...

2. JPA : Inheritance - Discriminator value not taken into account in generated SQL    stackoverflow.com

I try to use this mapping :

@Entity
@Table(name="ecc.\"RATE\"")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="DISCRIMINATOR", discriminatorType= DiscriminatorType.STRING)
public abstract class Rate extends GenericBusinessObject {
...
}

@Entity
@DiscriminatorValue("E")
public class EntranceRate extends Rate { 
 @ManyToOne
 @JoinColumn(name = "\"RATES_GRID_ID\"")
 protected RatesGrid ratesGrid;
...
}


@Entity
@Table(name="ecc.\"RATES_GRID\"")
public class RatesGrid extends ...

3. Hibernate char discriminator value    stackoverflow.com

Why does hibernate think that char discriminators are not safe: Using default @DiscriminatorValue for a discriminator of type CHAR is not safe

4. How to map one-to-many collection with join table using discriminator    stackoverflow.com

I'm trying to implement a basic tagging system with hibernate. The problem is that everyone has been subclassing Tag to make the mapping easier. I want to keep my Tag object ...

5. Single Table Inheritance WITHOUT Discriminator column    stackoverflow.com

Good Morning, my Dear comrades, This is starting to be come annoying - a simple thing, but hours of struggle, am I getting old?? I am trying to map two Classes to a ...

6. JPA - Issue implementing single table inheritance using discriminator    stackoverflow.com

I have two tables. Task and Content. Task forign keys to Content. I have one entity 'Task' mapped to the Task table. I have 4 entites (PrimaryContent, AttachmentContent, MetaContent, and CoversheetContent) ...

7. Discriminator value from separate table in Hibernate inheritance mapping    stackoverflow.com

I have two tables, price_feed and price_feed_type. Price feed will contain the data for different implementations of price feeds. Now, this would usually be done through the <discriminator> tag, with a ...

8. Discriminator not used in SQL for one-to-many mapping in ColdFusion ORM    stackoverflow.com

Let's say I have the following entities: Store:

component
{
    property name="Id" fieldtype="id" generator="native";
    property name="Name";
    property name="Fruits" fieldtype="one-to-many" cfc="Fruit" inverse="true" cascade="all-delete-orphan";
    ...

9. Hibernate won't add Discriminator Column to Table    stackoverflow.com

I previously had this entity

@Entity
@Table(name = "SOMETABLE")
@AccessType("field")
public class SomeEntity implements java.io.Serializable {
Then I changed it to this
@Entity
@Table(name = "SOMETABLE")
@AccessType("field")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "DISCRIMINATOR", discriminatorType = DiscriminatorType.STRING, length = 20)
@DiscriminatorValue(value = "Some")
public ...





10. Discriminator column is ignored in JOINED inheritance mappin    forum.hibernate.org

Hi, I met a problem in JPA mapping. I have the following mapping classes. When I try to insert a record of T5Slip, the discriminator column TAX_SLIP_TYPE is always NULL. If I generate DDL with Hibernate Tools, the Discriminator column is ignored. Anybody can help me? Code: @Entity @Table(name = "TAX_SLIP") @Inheritance(strategy=InheritanceType.JOINED) @DiscriminatorColumn(name = "TAX_SLIP_TYPE", discriminatorType = DiscriminatorType.STRING, length=20) @DiscriminatorValue("BaseTaxSlip") public ...

11. mapping multiple inhertance table per class + discriminator    forum.hibernate.org

Hi, hopefully this is straight forward to somebody, and I'm just looking at all the wrong examples or something. Below is an example of what I want to do. It is a very dumbed down example just to make my point. I have a class called "Vehicle". I then have a subclass of that called "Car". Car is then subclasses again ...

12. Single Table Inheritance WITHOUGHT Discriminator column    forum.hibernate.org

Good Morning, my Dear comrades, This is starting to be come annoying - a simple thing, but hours of struggle, am I getting old?? Right, I am trying to map two Classes to a single table using JPA by Hibernate. The idea is to have only a small subset of columns in parent Class, and bigger/full set in the child Class. ...

14. Help with mapping using discriminator    forum.hibernate.org

Damn, I'm confused. I have an interface, Animal, and two classes, Cat and Dog that implement the interface. Cat and Dog each have their own table. I have another class, FoundReport, that contains an instance of Animal which could be assigned either a Cat or Dog. And I can't figure out how to map all of this! I want my FoundReport ...

15. two discriminator values in inheritance??    forum.hibernate.org

....but on the other hand, writing this patch would be an good opportunity to enter into hibernate source code. Let's say I would write a patch. This patch would imply minor changes in very basic classes, I suppose. And a change in the mapping dtd. Would this patch be accepted and integrated into future hibernate releases ? More general: If I ...

16. Discriminator mapping problem    forum.hibernate.org

Author Message MarcusZ Post subject: Discriminator mapping problem Posted: Mon May 10, 2004 1:23 am Newbie Joined: Fri May 07, 2004 2:18 am Posts: 19 Hello I cannot figure this out. I have 2 base classes each with 2 subclasses like this Parent Parent1 extends Parent Parent2 extends Parent and Child Child1 extends Child Child2 extends Child Child1 has ...





17. Inheritance: Mapping discriminator values    forum.hibernate.org

I have a special case of mapping classes to tables. Facts: 1. Let's say I have a DB table called IDENTITY 2. 2 different classes map to this table via 3 discriminator values 3. Discriminator values have significance elsewhere in the application and thus are not solemnly for hibernate mapping purposes So, the two classes are: 1. ProgramID 2. PersonID Discriminator ...

18. fun with discriminator and inheritance    forum.hibernate.org

public class Father implements java.io.Serializable { private Long id; private String fathersName; public Father() { } public Father(Long id) { this.id = id; } ...

19. hierarchical mapping without discriminator    forum.hibernate.org

christophe_grosjean wrote: hi, I'd like to know how Hibernate can, in case of hierarchical mapping, instantiate the right class if no discriminator is defined in the mapping file. The documentation claims it does it. But I'd really to know how. Thanks for your answer Christophe The magic of implicit polymorphism =) I was really blown away the first time I tried ...

20. How to map table per concrete class without discriminator?    forum.hibernate.org

I have wasted a lot of time trying to get this mapping to work. Perhaps you can help: Code: CLASSES -------------------------------------------------------------------------------- Order Collection payments Payment (abstract class) Long paymentId CashPayment extends Payment String someCashSpecificAttribute ...

22. discriminator is repeated along inheritance, how to reuse?    forum.hibernate.org

trying to map a legacy db (sybase, why?), I encountered the following concern: discriminator is used couple of times along the inheritance, fetched using a formula (sql select something). I don't want to requery using that formula, but to reference that discriminator on the parent. more detailed: entitiy A has a discriminator 'Ad' fetched using a formula from another table. B ...

23. Mapping 1 class to 2 tables using a discriminator value    forum.hibernate.org

Hi Spaceman, With the use a discriminator, your ExtinctAnimals and NonExtinctAnimals will end up in one table: ... // declaration of properties ... ... but then you will have to create the subclasses NonExtinctAnimal and ExtinctAnimal. I know it is a bit turned around, with only ...

24. JPA: SINGLE_TABLE Inheritance, no discriminator in SQL    forum.hibernate.org

Newbie Joined: Thu Dec 20, 2007 11:25 am Posts: 1 Hello, environment: i use container managed jta transactions (glassfish v2, EJB 3.0) and i use only jpa, i.e. my whole application is container managed. model My model consits of two tables, a contracts table and a contract_data table. The contract table is mapped to ContractSuperClass and the contract_data table is mapped ...

25. map same column as discriminator and propery    forum.hibernate.org

Does anybody know if it is possible to map a column as a discriminator and a property in the same object, like: Code: ...

26. Mapping inheritance without discriminator column?    forum.hibernate.org

Hi guys, I have a question concerning mapping inheritance in Hibernate. I like to map the last subclass of the inheritance map to database tables and I want Hibernate not to use a discriminator column for mapping. Let's say I have the classes A, B and C and B is subclass of A and C is subclass of B: C extends ...