Hibernate JPA - "Could not create JPA based Configuration" in case if class has
no getter
-----------------------------------------------------------------------------------------
Key: HIBERNATE-114
URL:
https://jira.jboss.org/jira/browse/HIBERNATE-114
Project: Hibernate
Issue Type: Bug
Reporter: Vitali Yemialyanchyk
Assignee: Max Rydahl Andersen
Priority: Minor
I get the folowing problem with Hibernate JPA based configuration:
>>
orm.xml:
...
<entity class="TestIdClass">
<attributes>
<id name="testId">
<generated-value strategy="IDENTITY"/>
</id>
</attributes>
</entity>
...
>>
TestIdClass.java:
package ...
public class TestIdClass {
public Integer testId;
//public Integer getTestId() { return testId;}
}
>>
if you uncomment getter - Hibernate configuration
created successfully,
but in situation without getter I get the following exception - stacktrace:
org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based
Configuration
at
org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:163)
at
org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:644)
at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:629)
at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:288)
at
org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:64)
at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:270)
at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:113)
at
org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:40)
at
org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:99)
at
org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:105)
at
org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:234)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:148)
... 11 more
Caused by: javax.persistence.PersistenceException: org.hibernate.AnnotationException: No
identifier specified for entity: org.springframework.samples.petclinic.TestIdClass
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:258)
... 16 more
Caused by: org.hibernate.AnnotationException: No identifier specified for entity:
org.springframework.samples.petclinic.TestIdClass
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:650)
at
org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498)
at
org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269)
at
org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:186)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:246)
... 16 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira