2012-05-05 35 views
0

我想知道如果在父类和父类1中存在任何关系。然后,我可以使用Child类中的相同关系来获取Child1类。休眠:父类中的关联应该重复用于子类

Class GenericCalendar { 
    @JoinColumn(column = "FK_CUR_GEN_CAL") 
    GenericCalendarVersion currentGenericCalendarVersion; 
} 

Class GenericCalendarVersion { 
} 

Class ProcessingCalendar extends GenericCalendar { 
} 

Class ProcessingCalendarVersion extends GenericCalendarVersion { 
} 

所以我想从ProcessingCalendar检索ProcessingCalendarVersion。是否有可能获得一个?

+0

你有你的GenericCalendarVersion.class的用户类型吗? – Ilya

回答

0

你写的代码有点像这样,你将为每个子类的处理日历映射执行继承映射,并且处理日历也是一样的,你将通过投射从休眠的get方法返回的对象来检索processingCalendar对象会话和你可以从加载的对象访问processingCalendarversion对象。