Questions tagged [union-subclass]

10 questions
6
votes
1 answer

How to overcome the performance issues caused by the generated SQL of union-subclass in Hibernate

I am using Hibernate support for TABLE_PER_CLASS inheritance strategy. Functionality wise it works well. Whenever polymorphic query is issued Hibernate generates an SQL containing "union all" for my two concrete classes A & B. The generated SQL has…
4
votes
2 answers

Why can't NHibernate use Identity in union-subclass Table per Concrete Class mapping?

Several sources state that NHibernate can not use identity with table per concrete class and union-subclasses. Is this true, and what is the exact reason behind this ?
4
votes
1 answer

Hibernate inheritance performance

I am using Hibernate 3 with a MySQL database (I tried with Hibernate 4 with no more success). I've implemented a table-per-concrete-class inheritance strategy (union-subclass). It makes the job except for the polymorphic queries. Hibernate…
3
votes
2 answers

How to map an abstract property with NHibernate union subclass?

Referring to Ayende's post here: http://ayende.com/blog/3941/nhibernate-mapping-inheritance I have a similar situation that can be reached by extending the union-subclass mapping of the above post a bit, by adding an abstract Name-property to the…
proge
  • 31
  • 3
2
votes
1 answer

Why doesn't NHibernate limit the sub query of a union subclass to a particular id?

Ayende in his post on NHibernate Mapping – Inheritance outlines how the various NHibernate inheritance strategies work. His explanation of union-subclass shows the SQL generated as using a sub query which unions the various tables. This subquery is…
ahsteele
  • 26,243
  • 28
  • 134
  • 248
1
vote
0 answers

Questions relevant to "Table per concrete class mapping" in hibernate technique

Am trying to understand inheritance types with hibernate. when i look document there is "Table per concrete class" topic using union-subclass technique. Regarding this I am having some questions, 1). Why we need union-subclass mapping? 2). When…
Mohan
  • 877
  • 10
  • 20
  • 32
0
votes
1 answer

"NHibernate.ObjectNotFoundException: No row with the given identifier exists" on access to child collection

Little explanation: I have coupon series and coupons linked to the series. Some coupons may ne activated, and they are stored in the separate table. Here are my .hbm.xml files:
flam3
  • 1,897
  • 2
  • 19
  • 26
0
votes
1 answer

Object does not match target type.. Exception occured getter

I have a huge problem! I keep getting an exception when mapping an abstract class with multiple union-subclasses in nhibernate. When I use only one union-subclass I dont get any error and everything works fine. When I use more subclasses this error…
0
votes
1 answer

Nhibernate : Cannot use identity column key generation with mapping for:

I have three entity where Email & Sms entities is inherited of Message entity public class Message { virtual public long Id { get; set; } virtual public string Body { get; set; } } public class Email : Message { virtual public string…
Ehsan
  • 3,431
  • 8
  • 50
  • 70
0
votes
1 answer

Loading a collection of union-subclass entities polymorphically - column specified multiple times

Take the following entities: public class Company : Entity { public virtual string Name { get; set; } public virtual IList Employees { get; set; } public Company() { Id = Guid.NewGuid(); Employees =…