Link to home
Start Free TrialLog in
Avatar of justsomeguy1
justsomeguy1

asked on

Hibernate mapping without a class reference?

One limitation I discovered with my queries is that HQL will not let me use 'inner join on x', because it expects to discover the joined column through its own mapping files.

Say I have a very generic class like a Rating, which may be applied to comments, or submissions, or images ect. It makes sense for Rating to be reusable. However, I wouldn't want the Rating class to have a reference back to the other classes that might use it, for instance I wouldn't want references like Comment comment, Submission submission, when it makes more sense for it to have something like: private long referenceId; which could refer to any object.

Is there any wap to map a class without having a reference to the class, instead telling hibernate to just use the referenceId? Or is the correct and only solution to extend the Rating class whenever I need it, and make classes like CommentRating, SubmissionRating, which can be mapped normally?
ASKER CERTIFIED SOLUTION
Avatar of Gibu George
Gibu George
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial