Hi
I'm using Hibernate 3.6. I'm looking for advice...
I'm using Hibernate to manage a number of entities. The entities use inheritance. The root class is always automatically mapped to a table. The final subclass (or in some cases an intermediate class) is mapped to a database view. For example:
Code:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class ForumSubject implements Serializable
...
and:
Code:
@Entity
@Table(name = "forum_subject_headline_view")
public class ForumSubjectHeadline extends ForumSubject
...
where "forum_subject_headline_view" is a view. (I'm not at all sure that "@Table" is appropriate for the subclass.)
This is fine when performing selects, but it obviously fails when attempting to perform a remove on the subclass. The error is:
Code:
... ["http-bio-8080"-exec-4] ERROR org.hibernate.util.JDBCExceptionReporter - Can not delete from join view 'next.forum_subject_headline_view'
It would be possible to write native queries to perform the deletes, but this would be well short of ideal - it would create a lot of dependencies between subclass models.
What's the correct way of handling this?
Thank you for your help
Bruno.