Use this tag for questions related to the *mapping* in Hibernate and is called Table Per Subclass.
Questions tagged [table-per-subclass]
22 questions
3
votes
2 answers
Criteria query looking for rows using a specific subclass
I'll start with a sanitized example.
In my system, I've got the class Car. Car has a number of fields, among which is the gearShift instance of class GearShift.
public class Car {
private GearShift gearShift;
// Snip
}
GearShift is an…

SimonPip
- 437
- 7
- 14
2
votes
1 answer
Hibernate suitable inheritance strategy
This is the parent class
@MappedSuperclass
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class APostCommon extends Actionable {
private static final long serialVersionUID = 1L;
@Column(name = "TITLE")
private String…

ilkerbfl
- 23
- 1
- 4
2
votes
2 answers
Hibernate inheritance table per class and single table mix
I am developing online web shop, and I need help with Hibernate mapping. I have the following inheritance:
BaseProduct
/ \
Guitar Drum
/ \ / \
AcGuitar ElGuitar AcDrum ElectricDrum
What I…

doughting
- 382
- 4
- 10
2
votes
2 answers
NHibernate Table Per Subclass results in nonsensical INSERT statement - What am I doing wrong?
I have the following entities:
public abstract class User : IIdentity
{
private readonly UserType _userType;
public virtual int EntitySK { get; set; }
public virtual int TenantSK { get; set; }
public abstract string Name { get; set;…

Nick Williams
- 2,864
- 5
- 29
- 43
2
votes
1 answer
Association references unmapped - Collection of objects mapped by table per subclass strategy
I'm having problems with NHibernate mapping and I'm not sure if I made a noob mistake or whether I've run into a limitation of NHibernate
I have three domain objects with associated mapping hbm.xml files
Person
SpecialPerson
PersonCategory
public…

syclee
- 697
- 7
- 18
2
votes
1 answer
NHibernate Named query with table per subclass
I have a project where we are using only named queries to access the database. Recently we have created new entities that we were planing to map following the table per Subclass pattern, so we created the mappings following the documentation and…

Drevak
- 867
- 3
- 12
- 26
2
votes
1 answer
Fluent NHibernate automapping class conventions aren't being applied to entire class hierarchy
I'm trying to automap a simple inheritance hierarchy with Fluent Nhibernate, and I need to have a slightly different name for each table than its class (underscores instead of Pascal case). This seems like an obvious place to use conventions. I…

Paul Phillips
- 6,093
- 24
- 34
1
vote
0 answers
Not able to Save records using JPA table per sub class strategy
I have one parent entity and two child entities.
ReportDetails is my parent entity and ReportBarChart and ReportPieChart are my child entities. The above three share some common fields.
So to while saving the details I'm using table per sub class…

udaykiran.nalla
- 109
- 1
- 15
1
vote
0 answers
Hibernate error "object not found" using @Inheritance with Joined strategy
I have 3 Java classes (BaseEntity, User, Role) that are working correctly with Hibernate. Both User and Role are a subclass of BaseEntity. I have a table for my users and a table for my roles. There is a join table for the mapping of users to roles.…

Johanneke
- 5,443
- 4
- 20
- 33
1
vote
1 answer
Getting table-per-subclass objects in NHibernate
I've encountered a DB table called ScheduledJobs with a gazillion columns and a single matching C# object with an equal gazillion properties. I'm not thrilled with its design and wanted to break it up using a table-per-subclass strategy. Instead…

spamguy
- 1,575
- 2
- 17
- 37
1
vote
1 answer
nhibernate fluent mapping lazy load derived classes
Is it possible to get a table per concrete mapping in nhibernate/fluent to issue a database statement to determine the type of class and then issue another statement for the detail rather than joining all the subclass tables in a massive left joined…

Jim
- 14,952
- 15
- 80
- 167
0
votes
1 answer
How Polymorphic Association with TPC Inheritance Mapping is Treated in Professional Projects?
While designing & developing a data-centered project using Entity Framework, I have spent too much time to find a way to accomplish one of the following but have come across nothing practical.
To find an alternative to implement "Polymorphic…

Kamran
- 782
- 10
- 35
0
votes
1 answer
Fluent NHibernate and per-subclass inheritance
I have a Base class and two childs (A:Base and B:Base), and I want to map them to two tables (table A and table B). Is that possible in Fluent NHibernate? So I have:
public class Base
{
public virtual int Id {get;set;}
public virtual int…

Archeg
- 8,364
- 7
- 43
- 90
0
votes
0 answers
Table per Hierarchy without discriminator in EF core
There is a existing database and we have multiple columns to decide Table Per Hierarchy.It is not convenient to add any new column as discriminator. We have Table Per Hierarchy database structure as below.
Product - Base Entity (Database…

Jatin Dave
- 734
- 1
- 7
- 14
0
votes
1 answer
Table-per-subclass objects with same id collide in cache
I need to map a legacy table using Fluent NHibernate. I have no control over the table structure.
The table looks like this:
TypeId ObjectId Data
10 1 ... //Cat 1
10 2 ... //Cat 2
20 1 ... …

xinux
- 967
- 8
- 14