org.hibernate.AnnotationException: com.transparentpolitics.core.persistence.TransPolId has no persistent id property

Hibernate JIRA | Patrick Moore | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    [ANN-434] Confusing error message with @EmbeddedId and @Id - Hibernate JIRA

    atlassian.net | 1 year ago
    org.hibernate.AnnotationException: com.transparentpolitics.core.persistence.TransPolId has no persistent id property
  2. 0

    trying to create an entity with embeddedid and automatically generated ids. The resulting error message was very confusing and may be a bug as well. (See below for sample files) Notice the message is that TransPolId doesn't have an @Id property when in fact it does. The problem is 'solved' by removing the @Id in the TransPolId class. This caused a lot of wasted time on my part please fix for the next person! -------------------------------------------------------------------------------- Some additional debugging notes: The problem is caused in part because when expanding TransPolId to within AnnotationBinder.processElementAnnotations() isIdentifierMapper == false so none of the checks looking for this sort of thing execute. I believe the solution is to change AnnotationBinder.bindId() as follows: (original): if ( isComposite ) { id = fillComponent( propertyHolder, inferredData, isPropertyAnnotated, propertyAccessor, false, entityBinder, isEmbedded, isIdentifierMapper, mappings ); Component componentId = (Component) id; componentId.setKey( true ); if ( componentId.getPropertySpan() == 0 ) { throw new AnnotationException( componentId.getComponentClassName() + " has no persistent id property" ); } } (changed): if ( isComposite ) { id = fillComponent( propertyHolder, inferredData, isPropertyAnnotated, propertyAccessor, false, entityBinder, isEmbedded, true, mappings <<<<<<<<<<<<<<< isIdentifierMapper replaced by true ); Component componentId = (Component) id; componentId.setKey( true ); if ( componentId.getPropertySpan() == 0 ) { throw new AnnotationException( componentId.getComponentClassName() + " has no persistent id property" ); } } Output: java.vm.name=Java HotSpot(TM) Client VM, cache.provider_class=org.hibernate.cache.NoCacheProvider, file.encoding=Cp1252, java.specification.version=1.5, hibernate.show_sql=true, hibernate.connection.pool_size=1} 16:19:01,109 DEBUG [Configuration] Preparing to build session factory with filters : {} 16:19:01,109 DEBUG [AnnotationConfiguration] Execute first pass mapping processing 16:19:01,109 DEBUG [AnnotationConfiguration] Process hbm files 16:19:01,109 DEBUG [AnnotationConfiguration] Process annotated classes 16:19:01,125 INFO [AnnotationBinder] Binding entity from annotated class: com.transparentpolitics.core.persistence.IdUsing1 16:19:01,125 DEBUG [Ejb3Column] Binding column DTYPE unique false 16:19:01,125 DEBUG [EntityBinder] Import with entity name=IdUsing1 16:19:01,125 INFO [EntityBinder] Bind entity com.transparentpolitics.core.persistence.IdUsing1 on table IdUsing1 16:19:01,125 DEBUG [AnnotationBinder] Processing com.transparentpolitics.core.persistence.IdUsing1 property annotation 16:19:01,125 DEBUG [AnnotationBinder] Processing com.transparentpolitics.core.persistence.IdUsing1 field annotation 16:19:01,125 DEBUG [AnnotationBinder] Processing annotations of com.transparentpolitics.core.persistence.IdUsing1.transid 16:19:01,125 DEBUG [Ejb3Column] Binding column transid unique false 16:19:01,125 DEBUG [AnnotationBinder] transid is an id 16:19:01,125 DEBUG [AnnotationBinder] Binding component with path: com.transparentpolitics.core.persistence.IdUsing1.transid 16:19:01,125 DEBUG [AnnotationBinder] Processing com.transparentpolitics.core.persistence.TransPolId field annotation 16:19:01,125 DEBUG [AnnotationBinder] Processing annotations of com.transparentpolitics.core.persistence.TransPolId.id 16:19:01,125 DEBUG [Ejb3Column] Binding column id unique false 16:19:01,125 DEBUG [AnnotationBinder] id is an id 16:19:01,125 DEBUG [SimpleValueBinder] building SimpleValue for id 16:19:01,125 DEBUG [PropertyBinder] Building property id 16:19:01,125 DEBUG [PropertyBinder] Cascading id with null 16:19:01,125 DEBUG [AnnotationBinder] Bind @Id on id org.hibernate.AnnotationException: com.transparentpolitics.core.persistence.TransPolId has no persistent id property at org.hibernate.cfg.AnnotationBinder.bindId(AnnotationBinder.java:1686) at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1170) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:699) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:353) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:265) at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:682) ... 20 more @Embeddable public class TransPolId implements Serializable { @Id @GeneratedValue public Long id; @Override public boolean equals(Object o) { if ( o instanceof TransPolId ) { return ((TransPolId)o).id.equals(id); } return false; } @Override public int hashCode() { return id.hashCode(); } } @Entity public class IdUsing1 { @EmbeddedId public TransPolId id; public String value; }

    Hibernate JIRA | 1 decade ago | Patrick Moore
    org.hibernate.AnnotationException: com.transparentpolitics.core.persistence.TransPolId has no persistent id property
  3. 0

    trying to create an entity with embeddedid and automatically generated ids. The resulting error message was very confusing and may be a bug as well. (See below for sample files) Notice the message is that TransPolId doesn't have an @Id property when in fact it does. The problem is 'solved' by removing the @Id in the TransPolId class. This caused a lot of wasted time on my part please fix for the next person! -------------------------------------------------------------------------------- Some additional debugging notes: The problem is caused in part because when expanding TransPolId to within AnnotationBinder.processElementAnnotations() isIdentifierMapper == false so none of the checks looking for this sort of thing execute. I believe the solution is to change AnnotationBinder.bindId() as follows: (original): if ( isComposite ) { id = fillComponent( propertyHolder, inferredData, isPropertyAnnotated, propertyAccessor, false, entityBinder, isEmbedded, isIdentifierMapper, mappings ); Component componentId = (Component) id; componentId.setKey( true ); if ( componentId.getPropertySpan() == 0 ) { throw new AnnotationException( componentId.getComponentClassName() + " has no persistent id property" ); } } (changed): if ( isComposite ) { id = fillComponent( propertyHolder, inferredData, isPropertyAnnotated, propertyAccessor, false, entityBinder, isEmbedded, true, mappings <<<<<<<<<<<<<<< isIdentifierMapper replaced by true ); Component componentId = (Component) id; componentId.setKey( true ); if ( componentId.getPropertySpan() == 0 ) { throw new AnnotationException( componentId.getComponentClassName() + " has no persistent id property" ); } } Output: java.vm.name=Java HotSpot(TM) Client VM, cache.provider_class=org.hibernate.cache.NoCacheProvider, file.encoding=Cp1252, java.specification.version=1.5, hibernate.show_sql=true, hibernate.connection.pool_size=1} 16:19:01,109 DEBUG [Configuration] Preparing to build session factory with filters : {} 16:19:01,109 DEBUG [AnnotationConfiguration] Execute first pass mapping processing 16:19:01,109 DEBUG [AnnotationConfiguration] Process hbm files 16:19:01,109 DEBUG [AnnotationConfiguration] Process annotated classes 16:19:01,125 INFO [AnnotationBinder] Binding entity from annotated class: com.transparentpolitics.core.persistence.IdUsing1 16:19:01,125 DEBUG [Ejb3Column] Binding column DTYPE unique false 16:19:01,125 DEBUG [EntityBinder] Import with entity name=IdUsing1 16:19:01,125 INFO [EntityBinder] Bind entity com.transparentpolitics.core.persistence.IdUsing1 on table IdUsing1 16:19:01,125 DEBUG [AnnotationBinder] Processing com.transparentpolitics.core.persistence.IdUsing1 property annotation 16:19:01,125 DEBUG [AnnotationBinder] Processing com.transparentpolitics.core.persistence.IdUsing1 field annotation 16:19:01,125 DEBUG [AnnotationBinder] Processing annotations of com.transparentpolitics.core.persistence.IdUsing1.transid 16:19:01,125 DEBUG [Ejb3Column] Binding column transid unique false 16:19:01,125 DEBUG [AnnotationBinder] transid is an id 16:19:01,125 DEBUG [AnnotationBinder] Binding component with path: com.transparentpolitics.core.persistence.IdUsing1.transid 16:19:01,125 DEBUG [AnnotationBinder] Processing com.transparentpolitics.core.persistence.TransPolId field annotation 16:19:01,125 DEBUG [AnnotationBinder] Processing annotations of com.transparentpolitics.core.persistence.TransPolId.id 16:19:01,125 DEBUG [Ejb3Column] Binding column id unique false 16:19:01,125 DEBUG [AnnotationBinder] id is an id 16:19:01,125 DEBUG [SimpleValueBinder] building SimpleValue for id 16:19:01,125 DEBUG [PropertyBinder] Building property id 16:19:01,125 DEBUG [PropertyBinder] Cascading id with null 16:19:01,125 DEBUG [AnnotationBinder] Bind @Id on id org.hibernate.AnnotationException: com.transparentpolitics.core.persistence.TransPolId has no persistent id property at org.hibernate.cfg.AnnotationBinder.bindId(AnnotationBinder.java:1686) at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1170) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:699) at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:353) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:265) at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:682) ... 20 more @Embeddable public class TransPolId implements Serializable { @Id @GeneratedValue public Long id; @Override public boolean equals(Object o) { if ( o instanceof TransPolId ) { return ((TransPolId)o).id.equals(id); } return false; } @Override public int hashCode() { return id.hashCode(); } } @Entity public class IdUsing1 { @EmbeddedId public TransPolId id; public String value; }

    Hibernate JIRA | 1 decade ago | Patrick Moore
    org.hibernate.AnnotationException: com.transparentpolitics.core.persistence.TransPolId has no persistent id property
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hibernate one to many mapping error - mappedBy reference an unknown target entity property error

    Stack Overflow | 4 years ago | Roshini
    org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: FulltimeEmployee.FlightBenefit in FlightBenefit.FulltimeEmployees at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:708)
  6. 0

    Hibernate 4 : Why i am getting the AnnotationException : Unknown mappedBy?

    Stack Overflow | 3 years ago | Pracede
    org.hibernate.AnnotationException: Unknown mappedBy in: com.davy.app.domain.onetoone.one.entities.Address.student, referenced property unknown: com.davy.app.domain.onetoone.one.entities.Student.student

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.AnnotationException

      com.transparentpolitics.core.persistence.TransPolId has no persistent id property

      at org.hibernate.cfg.AnnotationBinder.bindId()
    2. Hibernate
      Configuration.generateDropSchemaScript
      1. org.hibernate.cfg.AnnotationBinder.bindId(AnnotationBinder.java:1686)
      2. org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1170)
      3. org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:699)
      4. org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:353)
      5. org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:265)
      6. org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:682)
      6 frames