-->
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.  [ 2 posts ] 
Author Message
 Post subject: Abstract Superclass DELETE not mapped error
PostPosted: Mon Apr 14, 2014 7:22 am 
Beginner
Beginner

Joined: Sat Feb 16, 2008 3:09 pm
Posts: 24
Hello,

using hibernate-jpa-2.1-api 1.0.0.Final, hibernate-entitymanager 4.0.1.Final
I want to use an abstract superclass
Code:
@MappedSuperclass
@NamedQueries({
   @NamedQuery(name="Gesamtendscheidung.DeleteAll", query="DELETE FROM Gesamtentscheidung g"),
   @NamedQuery(name="Gesamtendscheidung.FindAll", query="SELECT g From Gesamtentscheidung g")
})
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class Gesamtentscheidung implements Serializable


When I run the named queries I get
Code:
ERROR: HHH000177: Error in named query: Gesamtendscheidung.DeleteAll
org.hibernate.hql.internal.ast.QuerySyntaxException: Gesamtentscheidung is not mapped [DELETE FROM Gesamtentscheidung g]

ERROR: HHH000177: Error in named query: Gesamtendscheidung.FindAll
org.hibernate.hql.internal.ast.QuerySyntaxException: Gesamtentscheidung is not mapped [SELECT g From Gesamtentscheidung g]


How can I find all instances or delete all instances in this kind of class hierachy?

Thanks

Hans


Top
 Profile  
 
 Post subject: Re: Abstract Superclass DELETE not mapped error
PostPosted: Mon Apr 14, 2014 7:38 am 
Beginner
Beginner

Joined: Sat Feb 16, 2008 3:09 pm
Posts: 24
OK answer is
replace @MappedSuperclass with @Entity
MappedSuperclasses cannot be used in queries.

Question: Is there any advantage to use @MappedSuperclass instead of @Entity


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.