Hibernate mapping without a class reference?
Posted on 2009-05-01
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?