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: Entities constructed from views - remove?
PostPosted: Mon Oct 17, 2011 2:05 pm 
Newbie

Joined: Fri Jul 08, 2011 8:45 am
Posts: 6
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.


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.