-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate complains missing @Entity annotations
PostPosted: Sat Dec 03, 2005 7:58 am 
Beginner
Beginner

Joined: Thu Sep 01, 2005 10:09 am
Posts: 39
I already asked this some time ago but got no helpful hints. Since I upgraded to rc1/beta6 I get this Exception where hibernate complains about a missing @Entity annotation, but it IS there ! Any help ?

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.1rc1 annotations beta 6

Mapping documents:
package eiswind.paris.model;

import javax.persistence.Entity;
import javax.persistence.GeneratorType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.hibernate.validator.Length;




@Entity

public class Adress extends BaseEntity{

...

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
Caused by: org.hibernate.AnnotationException: Annotated class should have a @javax.persistence.Entity, @javax.persistence.Embeddable or @javax.persistence.EmbeddedSuperclass annotation: eiswind.paris.model.Adress
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:334)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:256)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:191)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:638)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:94)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:62)
at eiswind.paris.application.HibernateUtil$1.run(HibernateUtil.java:44)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)


Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 6:21 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
use your debugger, there is no reason for this.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Re: Hibernate complains missing @Entity annotations
PostPosted: Sun Dec 04, 2005 6:24 pm 
Newbie

Joined: Sun Oct 30, 2005 9:58 am
Posts: 2
hyperion wrote:
@Entity

public class Adress extends BaseEntity{


Can u post the code where you declare your annotated classes ?
hibernate.cfg.xml or the code that looks like:

Code:
AnnotationConfiguration conf = new AnnotationConfiguration();   
   conf = conf.addAnnotatedClass("package.class");      


I had the same pb the solution was here if I remember well...


Top
 Profile  
 
 Post subject: Here the code
PostPosted: Mon Dec 05, 2005 5:16 am 
Beginner
Beginner

Joined: Thu Sep 01, 2005 10:09 am
Posts: 39
Code:
public static void initHibernate() {
      //IWorkbench wb = PlatformUI.getWorkbench();
      IRunnableWithProgress task = new IRunnableWithProgress()  {
         public void run(IProgressMonitor pm) {
               pm.beginTask("Anwendung wird gestartet",4);
               pm.subTask("Configuration wird eingelesen");
               AnnotationConfiguration conf = new AnnotationConfiguration();
               //conf.addAnnotatedClass(Category.class);
               conf.addAnnotatedClass(Adress.class);
               conf.addAnnotatedClass(CategoryGroup.class);
               conf.addAnnotatedClass(Person.class);
               conf.addAnnotatedClass(PhoneNumber.class);
               pm.worked(1);
//               pm.subTask("Schema wird erzeugt");
//               SchemaExport exporter = new SchemaExport(conf);
//               exporter.setOutputFile("schema.ddl");
//               exporter.setDelimiter(";");
//               exporter.create(true, false);
//               pm.worked(2);
               pm.subTask("SessionFactory wird erzeugt");
               sessionFactory = conf.buildSessionFactory();
               pm.worked(3);
            
         }
      };
      try {
         new ProgressMonitorDialog(null).run(true, false, task);
      }catch(InvocationTargetException x){
         log.error("Initailisierung von Hibernate ist fehlgeschlagen",x);
      }catch(InterruptedException x){
         log.error("Initailisierung von Hibernate wurde abgebrochen",x);
         
      }


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.