-->
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 Interfaces
PostPosted: Thu May 27, 2004 3:26 pm 
Beginner
Beginner

Joined: Thu May 27, 2004 3:07 pm
Posts: 20
Here's my situation. I'd like to have hibernate map an interface class, and configure it as to which subclass to instantiate when it is retrieved from the database. The basic reason is that when one module has an instance of another' module's interface, the relationship between the two should not be specified in terms of interface classes

public class Module1Intf {
int getId();
void setId(int id);

Module2Intf getModule2Intf();
void setModule2Intf(Module2Intf intf);
}

public class Module2Intf {
int getId();
void setId(int id);
}

public class Module1IntfImpl implements Module1Intf{
...
}

public class Module2IntfImpl implements Module2Intf{
...
}

If mappings are done in the implementation classes, then the
mapping for Module1IntfImpl needs to know about the implementation
class for Module2Intf. This is a bad thing, as it will violate the whole
notion of implementation hiding.

What i'd like to do is to create the mappings on the interface, and
have a way of telling hibernate which class to instantiate when it
loads from the database.

Any help here would be appreciated.


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.