PDA

View Full Version : RC2: org.hibernate.AnnotationException: No identifier specified for entity



Fireball
Oct 5th, 2009, 02:56 PM
I use the new RC2 and if i run a demo app with only one persistent class i get the following exception:


Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.hra.pizza.domain.Product
at org.hibernate.cfg.AnnotationBinder.bindClass(Annot ationBinder.java:671)
at org.hibernate.cfg.AnnotationConfiguration.processA rtifactsOfType(AnnotationConfiguration.java:534)
at org.hibernate.cfg.AnnotationConfiguration.secondPa ssCompile(AnnotationConfiguration.java:286)
at org.hibernate.cfg.Configuration.buildMappings(Conf iguration.java:1121)
at org.hibernate.ejb.Ejb3Configuration.buildMappings( Ejb3Configuration.java:1225)
at org.hibernate.ejb.EventListenerConfigurator.config ure(EventListenerConfigurator.java:159)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3 Configuration.java:854)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3 Configuration.java:425)
at org.hibernate.ejb.HibernatePersistence.createConta inerEntityManagerFactory(HibernatePersistence.java :131)
at org.springframework.orm.jpa.LocalContainerEntityMa nagerFactoryBean.createNativeEntityManagerFactory( LocalContainerEntityManagerFactoryBean.java:225)
at org.springframework.orm.jpa.AbstractEntityManagerF actoryBean.afterPropertiesSet(AbstractEntityManage rFactoryBean.java:288)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1454)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1392)
... 37 more

I used the pom generated by roo, no special entries.

Any ideas?

Cheers Fireball

Ben Alex
Oct 5th, 2009, 09:48 PM
Can you please include Product*.* file contents as an attachment? That way we can take a look. Alternately or additionally, can you also please provide the Roo commands you used to create the application so that we can attempt to reproduce.

Fireball
Oct 6th, 2009, 02:27 PM
Sorry, but i can't reproduce the error. Perhaps a subspace anomaly :-)

Ben Alex
Oct 6th, 2009, 10:23 PM
Great to hear you got it working. Please don't hesitate to post other threads if we can be of further assistance.

rblumen
Mar 6th, 2010, 06:13 PM
I have not been able to run my Spring/ROO/JPA application due to the error ""no identifier specified for entity" under some conditions

1. The entity was created by ROO. It has the standard "Long id" identifier in the Roo_Entity.aj file

2. If I manually move the id field definition to the .java file (not moving the getters and setters), the problem goes away.

3. The problem has occurred under Eclipse but not when I run the same test from the maven command line.

4. The problem is somewhat unstable (a "heisenbug" ). I have long suspected that the incremental compilation feature in Eclipse with AJDT eventually gets corrupted after repeated incremental compilations. As a troubleshooting step, I turned off incremental compilation, did a clean, followed by a build. In one case the problem went away, but this does not seem to be a general solution. Other times I have done a clean and a build without the problem going away.

-Robert Blumen

-Robert Blumen