-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: table-per-class-hierarchy Subclass Substitution Mapping
PostPosted: Fri Jan 20, 2006 12:58 pm 
Newbie

Joined: Tue Mar 15, 2005 4:16 pm
Posts: 2
Hibernate version:
3.1.1

In the following forum topic: http://forum.hibernate.org/viewtopic.php?t=950827, giulio.vezzelli asked about how to accomplish substitution of a base class by a subclass using table-per-class-hierarchy mapping definitions. I'm looking to do essentially the same thing.

I'd like to define a <class> mapping in my core product, then allow customizations of my product to define a <subclass> mapping that extends and essentially replaces the base mapping to the same table. At no time should the base class ever be instantiated if there's a subclass defined with the same discriminator value.

I'm using Hibernate 3.x, and I'm a relative newbie at it, but I've searched the docs and can't come up with anything obvious.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 2:37 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 1:30 pm
Posts: 27
I'm trying to come up with a similar system.

There are a few models and controllers I reuse over and over. It would be nice if I could just create a project/jar that would contain these and I can extend them

One of the first problems I ran into was relationships.

I have a class EmailLog which has many-to-one relationships between BaseUser and Email.
I marked BaseUser as @EmbeddableSuperClass because for each other application I want to extend it and put more columns in the User table. But if I do this, then EmailLog cannot find the User Entity. Granted I can promote BaseUser to an Entity and have another class altogether, but I would prefer not to do that.

Any ideas?

Has anyone done something like this before?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.