-->
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: Mapping for the "separated interface" pattern
PostPosted: Wed Apr 06, 2005 7:22 pm 
Beginner
Beginner

Joined: Fri Oct 15, 2004 9:58 pm
Posts: 25
I would like to use "separated interface" pattern to code the objects. That is there are two class files for each object, an interface and an implementation. The clients of these objects always refer to the objects by the interface name and not the implementation. They even query based on the interface name instead of the implementation. So the hibernate mapping should refer to the interface.

But it won't work because Hibernate needs a public constructor. I have tried to use the implementation class as <sublass> of the interface but it won't work entirely because I have other inherited classes/interfaces that would have to be mapped with <joined-subclass>.

For Example,

I have 3 interfaces Pet, Cat and Dog. The later two extending the Pet interface. Similary I have 3 implementation classes PetImpl, CatImpl and DogImpl (all of them not abstract) respectively for each interface with the later two extending the PetImpl class. This is somewhat similar to what Eclipse code generator does. I want to map the inheritance between Pet, Cat and Dog using joined-subclass.

How can I direct the Hibernate to instantiate PetImpl class instead of Pet when these are referenced in queries or load or save?

Thanks,
Prasad


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.