Entities can't also be MappedSuperclasses
-----------------------------------------
Key: HHH-5822
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5822
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.0.Beta1, 3.5.2
Reporter: Laran Evans
I recently upgraded Hibernate and discovered trouble.
We've got a situation where we have two classes mapped to a single table.
@MappedSuperclass
@Entity
@Table(name="thing")
class ThingLite {
// ... basic, shared fields
}
@Entity
@Table(name="thing")
class Thing extends ThingLite {
// ... extra fields
}
Both classes do truly map to the same table. ThingLite just doesn't pull back all of
the fields that Thing does. The table contains a blob column which we don't need most
of the time.
In retrospect, we could have used a joined table strategy, separating the blob column and
the fields specific to Thing into a separate table. But we didn't. And going back now
to redesign the tables isn't an option.
HHH-5125 makes it no longer possible to have a superclass that is both an Entity and a
MappedSuperclass, and I'm not convinced that it shouldn't be allowed.
Do you guys agree that it should be possible? I can't think of a specific reason that
it shouldn't be.
An alternative approach that I thought of would be to use a joined inheritance approach,
joining on the same table to get the additional fields for Thing. When I tried it however
I got errors relating to circular references. I don't quite understand why this should
be the case. Niether Thing nor ThingLite have references to one another other than the
fact that Thing extends ThingLite.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira