some.package.SomeEntity

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I'm trying to map a class hierarchy with the identifier property inherited from an abstract base class: @MappedSuperclass public abstract class AbstractPersistenceObject { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE) private long id; public long getId() { return id; } } and accordingly @Entity public class SomeEntity extends AbstractPersistenceObject { @Column private int refNo; @Column @Temporal(TemporalType.TIMESTAMP) private Date creationDate; ... Persisting entities and automatic schema creation works fine. But when trying to export the ddl using either the Hibernate Tools Eclipse-Console or the following Ant-target: <target name="generate-hibernate-mapping" depends="init"> <property name="hibernate-tool-dir" location="${other.hibernate-tool.location}" /> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${hibernate-tool-dir}" /> <hibernatetool> <annotationconfiguration configurationfile="hibernate.cfg.xml" > </annotationconfiguration> <hbm2ddl destdir="${bin-dir}/generated"/> </hibernatetool> </target> I get the following exception: [hibernatetool] 17:32:40,808 INFO Environment:479 - Hibernate 3.1.1 [hibernatetool] 17:32:40,828 INFO Environment:509 - hibernate.properties not found [hibernatetool] 17:32:40,828 INFO Environment:525 - using CGLIB reflection optimizer [hibernatetool] 17:32:40,828 INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling [hibernatetool] 17:32:40,938 INFO Configuration:1330 - configuring from file: ibernate.cfg.xml [hibernatetool] 17:32:41,188 INFO Configuration:1407 - Configured SessionFactory: hibernate/SessionFactory [hibernatetool] 17:32:41,248 INFO AnnotationBinder:340 - Binding entity from annotated class: java.lang.Class [hibernatetool] 17:32:41,308 INFO EntityBinder:298 - Bind entity some.package.SomeEntity on table SOMEENTITY BUILD FAILED No identifier specified for entity: some.package.SomeEntity at org.apache.tools.ant.Task.perform(Task.java:373) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40) at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) Caused by: org.hibernate.AnnotationException: No identifier specified for entity: some.package.SomeEntity at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:648) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:266) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:199) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:996) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:56) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:179) at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:43) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) ... 9 more --- Nested Exception --- org.hibernate.AnnotationException: No identifier specified for entity: some.package.SomeEntity at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:648) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:266) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:199) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:996) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:56) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:179) at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:43) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40) at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
    via by Wolfgang Gottesheim,
  • I'm trying to map a class hierarchy with the identifier property inherited from an abstract base class: @MappedSuperclass public abstract class AbstractPersistenceObject { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE) private long id; public long getId() { return id; } } and accordingly @Entity public class SomeEntity extends AbstractPersistenceObject { @Column private int refNo; @Column @Temporal(TemporalType.TIMESTAMP) private Date creationDate; ... Persisting entities and automatic schema creation works fine. But when trying to export the ddl using either the Hibernate Tools Eclipse-Console or the following Ant-target: <target name="generate-hibernate-mapping" depends="init"> <property name="hibernate-tool-dir" location="${other.hibernate-tool.location}" /> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${hibernate-tool-dir}" /> <hibernatetool> <annotationconfiguration configurationfile="hibernate.cfg.xml" > </annotationconfiguration> <hbm2ddl destdir="${bin-dir}/generated"/> </hibernatetool> </target> I get the following exception: [hibernatetool] 17:32:40,808 INFO Environment:479 - Hibernate 3.1.1 [hibernatetool] 17:32:40,828 INFO Environment:509 - hibernate.properties not found [hibernatetool] 17:32:40,828 INFO Environment:525 - using CGLIB reflection optimizer [hibernatetool] 17:32:40,828 INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling [hibernatetool] 17:32:40,938 INFO Configuration:1330 - configuring from file: ibernate.cfg.xml [hibernatetool] 17:32:41,188 INFO Configuration:1407 - Configured SessionFactory: hibernate/SessionFactory [hibernatetool] 17:32:41,248 INFO AnnotationBinder:340 - Binding entity from annotated class: java.lang.Class [hibernatetool] 17:32:41,308 INFO EntityBinder:298 - Bind entity some.package.SomeEntity on table SOMEENTITY BUILD FAILED No identifier specified for entity: some.package.SomeEntity at org.apache.tools.ant.Task.perform(Task.java:373) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40) at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) Caused by: org.hibernate.AnnotationException: No identifier specified for entity: some.package.SomeEntity at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:648) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:266) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:199) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:996) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:56) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:179) at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:43) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) ... 9 more --- Nested Exception --- org.hibernate.AnnotationException: No identifier specified for entity: some.package.SomeEntity at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:648) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:266) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:199) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:996) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:56) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:179) at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:43) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40) at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
    via by Wolfgang Gottesheim,
  • Had this posted in the Tools forum and didn't get any response. Hope it's OK to create an issue so that it's not forgotten. I'm testing the new ant task in hibernate-tools and I have annotated my classes with @Entity (org.hibernate.annotations.Entity, not javax.persistence.Entity). After running the HibernateToolTask as per docs I get the following error even though the class file is annotated (checked with bytecode viewer): (package changed to *** in below) org.hibernate.AnnotationException: Annotated class should have an @Entity, @Embeddable or @EmbeddedSuperclass annotation: com.***.DeviceFirmwareFamilyImpl at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:274) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:174) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:825) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:51) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:150) at org.hibernate.tool.ant.Hbm2DDLGeneratorTask.execute(Hbm2DDLGeneratorTask.java:38) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115) This is the xml I'm using (both build and config): <target name="devicedb2" description="(Re)builds the database schema" depends="init"> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="project.classpath"/> <hibernatetool destdir="${target.dir}/hibtool"> <classpath refid="project.classpath"/> <annotationConfiguration configurationfile="hibernate.cfg.xml" propertyFile="${target.classes.dir}/hibernate.properties"/> <hbm2ddl/> </hibernatetool> </target> <hibernate-configuration> <session-factory> <mapping class="com.***.DeviceFirmwareFamilyImpl"/> </session-factory> </hibernate-configuration> I've tried both hibernate-tools3-alpha4 as well as rebuilding the latest from CVS (along with all dependencies), but still get this error. Looking at AnnotationConfiguration.java, it seems that the following code: public AnnotatedClassType addClassType(Class clazz) { AnnotatedClassType type; if ( clazz.isAnnotationPresent(Entity.class) ) { type = AnnotatedClassType.ENTITY; } else if (clazz.isAnnotationPresent(Embeddable.class) ) { type = AnnotatedClassType.EMBEDDABLE; } else if (clazz.isAnnotationPresent(EmbeddedSuperclass.class) ) { type = AnnotatedClassType.EMBEDDED_SUPERCLASS; } else { type = AnnotatedClassType.NONE; } classTypes.put(clazz, type); return type; } assumes @Entity annotations will be of type javax.persistence.Entity since that's what it imports. How is the extended Entity annotation meant to be used from this configuration? For that matter, are there other extended annotations that would cause an error?
    via by Adrian Sampaleanu,
  • Had this posted in the Tools forum and didn't get any response. Hope it's OK to create an issue so that it's not forgotten. I'm testing the new ant task in hibernate-tools and I have annotated my classes with @Entity (org.hibernate.annotations.Entity, not javax.persistence.Entity). After running the HibernateToolTask as per docs I get the following error even though the class file is annotated (checked with bytecode viewer): (package changed to *** in below) org.hibernate.AnnotationException: Annotated class should have an @Entity, @Embeddable or @EmbeddedSuperclass annotation: com.***.DeviceFirmwareFamilyImpl at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:274) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:174) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:825) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:51) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:150) at org.hibernate.tool.ant.Hbm2DDLGeneratorTask.execute(Hbm2DDLGeneratorTask.java:38) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:115) This is the xml I'm using (both build and config): <target name="devicedb2" description="(Re)builds the database schema" depends="init"> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="project.classpath"/> <hibernatetool destdir="${target.dir}/hibtool"> <classpath refid="project.classpath"/> <annotationConfiguration configurationfile="hibernate.cfg.xml" propertyFile="${target.classes.dir}/hibernate.properties"/> <hbm2ddl/> </hibernatetool> </target> <hibernate-configuration> <session-factory> <mapping class="com.***.DeviceFirmwareFamilyImpl"/> </session-factory> </hibernate-configuration> I've tried both hibernate-tools3-alpha4 as well as rebuilding the latest from CVS (along with all dependencies), but still get this error. Looking at AnnotationConfiguration.java, it seems that the following code: public AnnotatedClassType addClassType(Class clazz) { AnnotatedClassType type; if ( clazz.isAnnotationPresent(Entity.class) ) { type = AnnotatedClassType.ENTITY; } else if (clazz.isAnnotationPresent(Embeddable.class) ) { type = AnnotatedClassType.EMBEDDABLE; } else if (clazz.isAnnotationPresent(EmbeddedSuperclass.class) ) { type = AnnotatedClassType.EMBEDDED_SUPERCLASS; } else { type = AnnotatedClassType.NONE; } classTypes.put(clazz, type); return type; } assumes @Entity annotations will be of type javax.persistence.Entity since that's what it imports. How is the extended Entity annotation meant to be used from this configuration? For that matter, are there other extended annotations that would cause an error?
    via by Adrian Sampaleanu,
  • @Embeddable Issue with Spring and Hibernate3
    via Stack Overflow by Ben Dol
    ,
  • No me lista la colección
    via openxava by fredy1982
    ,
    • some.package.SomeEntity at org.apache.tools.ant.Task.perform(Task.java:373) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.tools.ant.Target.performTasks(Target.java:369) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) at org.apache.tools.ant.Project.executeTarget(Project.java:1185) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40) at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) at org.apache.tools.ant.Project.executeTargets(Project.java:1068) at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) Caused by: org.hibernate.AnnotationException: No identifier specified for entity: some.package.SomeEntity at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:648) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:266) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:199) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:996) at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:56) at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:179) at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:43) at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) ... 9 more

    Users with the same issue

    oddodd
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,