org.springframework.data.mapping.model.MappingException: An ID property is needed, but not found on this entity.

Spring JIRA | srikanth Hugar | 3 years ago
  1. 0

    spring-data-couchbase - org.springframework.data.mapping.model.MappingException

    Stack Overflow | 3 years ago | Srikanth Hugar
    org.springframework.data.mapping.model.MappingException: An ID property is needed, but not found on this entity.
  2. 0

    I'm trying to persist the object with spring-data-couchbase version 1.0.0.RC1 . ======================================================================= package com.spring.data.couchbase.user; import javax.persistence.Entity; import org.springframework.data.annotation.Id; import org.springframework.data.couchbase.core.mapping.Field; @Entity public class User { @Id private String id; public String getId() { return id; } public void setId(String id) { this.id = id; } @Field("lastName") private String lastName; public String getLastName() { return lastName; } public void setLastname(String lastName) { this.lastName = lastName; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @Field("firstName") private String firstName; } ======================================================================= I get a MappingException when I try to save the object to couchbase database. Full stack below. AFAIK entiry seems to be fine. Anything extra expected by spring-data-couchbase ? ======================================================================== Exception in thread "main" org.springframework.data.mapping.model.MappingException: An ID property is needed, but not found on this entity. at org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.write(MappingCouchbaseConverter.java:316) at org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.write(MappingCouchbaseConverter.java:50) at org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:298) at org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:149) at org.springframework.data.couchbase.repository.support.SimpleCouchbaseRepository.save(SimpleCouchbaseRepository.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:358) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:343) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.data.couchbase.repository.support.ViewPostProcessor$ViewInterceptor.invoke(ViewPostProcessor.java:80) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy18.save(Unknown Source) at com.spring.data.couchbase.user.MyService.doWork(MyService.java:27) at com.spring.data.couchbase.user.Main.main(Main.java:17)

    Spring JIRA | 3 years ago | srikanth Hugar
    org.springframework.data.mapping.model.MappingException: An ID property is needed, but not found on this entity.
  3. 0

    I'm trying to persist the object with spring-data-couchbase version 1.0.0.RC1 . ======================================================================= package com.spring.data.couchbase.user; import javax.persistence.Entity; import org.springframework.data.annotation.Id; import org.springframework.data.couchbase.core.mapping.Field; @Entity public class User { @Id private String id; public String getId() { return id; } public void setId(String id) { this.id = id; } @Field("lastName") private String lastName; public String getLastName() { return lastName; } public void setLastname(String lastName) { this.lastName = lastName; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @Field("firstName") private String firstName; } ======================================================================= I get a MappingException when I try to save the object to couchbase database. Full stack below. AFAIK entiry seems to be fine. Anything extra expected by spring-data-couchbase ? ======================================================================== Exception in thread "main" org.springframework.data.mapping.model.MappingException: An ID property is needed, but not found on this entity. at org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.write(MappingCouchbaseConverter.java:316) at org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.write(MappingCouchbaseConverter.java:50) at org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:298) at org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:149) at org.springframework.data.couchbase.repository.support.SimpleCouchbaseRepository.save(SimpleCouchbaseRepository.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:358) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:343) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.data.couchbase.repository.support.ViewPostProcessor$ViewInterceptor.invoke(ViewPostProcessor.java:80) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy18.save(Unknown Source) at com.spring.data.couchbase.user.MyService.doWork(MyService.java:27) at com.spring.data.couchbase.user.Main.main(Main.java:17)

    Spring JIRA | 3 years ago | srikanth Hugar
    org.springframework.data.mapping.model.MappingException: An ID property is needed, but not found on this entity.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    "MappingException: No property null found on entity class java.time.OffsetDateTime to bind constructor parameter to!" with Spring MongoDB

    Stack Overflow | 10 months ago | Shark
    org.springframework.data.mapping.model.MappingException: No property null found on entity class java.time.OffsetDateTime to bind constructor parameter to!
  6. 0

    Mongo spring-data issue with java.util.Currency

    Stack Overflow | 10 months ago | Dinkar Thakur
    org.springframework.data.mapping.model.MappingException: No property null found on entity class java.util.Currency to bind constructor parameter to!

    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.springframework.data.mapping.model.MappingException

      An ID property is needed, but not found on this entity.

      at org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.write()
    2. Spring Data Couchbase
      SimpleCouchbaseRepository.save
      1. org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.write(MappingCouchbaseConverter.java:316)
      2. org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.write(MappingCouchbaseConverter.java:50)
      3. org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:298)
      4. org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:149)
      5. org.springframework.data.couchbase.repository.support.SimpleCouchbaseRepository.save(SimpleCouchbaseRepository.java:82)
      5 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:601)
      4 frames
    4. Spring Data Core
      RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:358)
      2. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:343)
      2 frames
    5. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      1 frame
    6. Spring Data Couchbase
      ViewPostProcessor$ViewInterceptor.invoke
      1. org.springframework.data.couchbase.repository.support.ViewPostProcessor$ViewInterceptor.invoke(ViewPostProcessor.java:80)
      1 frame
    7. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      2. org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      4. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      4 frames
    8. Unknown
      $Proxy18.save
      1. $Proxy18.save(Unknown Source)
      1 frame
    9. com.spring.data
      Main.main
      1. com.spring.data.couchbase.user.MyService.doWork(MyService.java:27)
      2. com.spring.data.couchbase.user.Main.main(Main.java:17)
      2 frames