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.  [ 1 post ] 
Author Message
 Post subject: Map Interfaces or concrete classes: any advice ?
PostPosted: Fri Oct 22, 2004 12:12 pm 
Newbie

Joined: Fri Oct 22, 2004 12:00 pm
Posts: 1
I'm implementing Hibernate for the first time, and I have run into a number of problems with the use of interfaces and subclasses which I'm unable to find any particular samples or advice on. I'm using Hibernate 2.1.6 and generating mappings via Hibernatedoclet (xdoclet). Any comments welcome.

I have a simple inheritance structure as follows:

Interfaces:
Company,
BuyingCompany extends Company
SupplierCompany extends Company

Classes:
AbstractCompany implements Company
BuyingCompanyImlp extends AbstractCompany, implements BuyingCompany
SupplierCompanyImpl extends AbstractCompany, implements SupplierCompany

The problems I'm getting are both conceptual and practical.

Firstly, if I try and generate mappings from the interfaces, I get a problem with the hibernate doclet not mapping joined-subclasses for interfaces (ie Company will be generated, but joined-subclass BuyerCompany will not). Regardless of this problem, is it good practice to map interfaces rather than concrete/absract classes ?

If I do the mapping on the classes rather than the interfaces (ie AbstractCompany), I get all kinds of problems when I try and retrieve instances. For example, if I try find("from Company"), I get a Hibernate mapping error. However, I want to try and get instances of Company interface, rather than AbstractCompany or BuyerCompanyImpl.

I hope this makes sense, Grateful for any comments or pointers,

Regards,

_________________
Lawrie Nichols


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

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.