Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

301
Visualizações
"Representación hexadecimal no válida" para la interfaz del repositorio de datos Spring Mongo

Tengo una interfaz de repositorio de la siguiente manera:

 public interface ExcursionAttendeeRepository extends MongoRepository<ExcursionAttendee, String> { ExcursionAttendee findByWorkflowItemId(String workflowItemId); @Query("{ 'excursionEvent._id' : { '$oid' : ?0 } }") List<ExcursionAttendee> findByExcursionId(String excursionId); @Query("{ 'student._id' : {'$oid' : ?0} , 'excursionEvent._id' : { '$oid' : ?1 } }") ExcursionAttendee findByStudentIdAndEventId(String studentId, String excursionId); @Query("{ 'student._id' : { '$oid' : ?0 } }") List<ExcursionAttendee> findByStudentId(String studentId); }

Mientras que el resorte de creación de Bean lanza la siguiente excepción.

 Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer#0.1': Cannot create inner bean '(inner bean)#5172829b' of type [org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter] while setting bean property 'messageListener'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5172829b': Cannot resolve reference to bean 'productDetailsEventConsumer' while setting bean property 'delegate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productDetailsEventConsumer': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.cinglevue.veip.service.excursion.ExcursionAttendeeService com.cinglevue.veip.service.erp.impl.ProductDetailsEventConsumer.excursionAttendeeService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'excursionAttendeeServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.cinglevue.veip.repository.excursion.ExcursionAttendeeRepository com.cinglevue.veip.service.excursion.impl.ExcursionAttendeeServiceImpl.excursionAttendeeRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'excursionAttendeeRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: invalid hexadecimal representation of an ObjectId: [_param_0]

Idealmente, estas excepciones deberían lanzarse al intentar inicializar un ObjectId con una cadena no válida. [ código ]. Me pregunto cómo se inicializa la clase para que se produzca una excepción durante la creación del bean. ¿Algún consejo sobre esto?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Me encontré con la misma pregunta y lo siguiente debería funcionar.

 @Query("{ 'student' : { '$id': ?0 } }") List<ExcursionAttendee> findByStudentId(String studentId);

Si es un DBRef, debería ser así (esto es lo que estoy usando después del mismo problema, tengo un DBRef en mi caso)

 @Query("{ 'student': {'$ref': 'user', '$id': ?0} }") List<ExcursionAttendee> findByStudentId(String studentId);

Para DBRef esto debería funcionar también,

 List<ExcursionAttendee> findByStudentId(String studentId);

Encontré la respuesta desde aquí .

over 4 years ago · Santiago Trujillo Relatório

0

 @Query("{ 'student._id' : {'$oid' : ?0} , 'excursionEvent._id' : { '$oid' : ?1 } }") ExcursionAttendee findByStudentIdAndEventId(String studentId, String excursionId);

No necesita especificar @Query si sigue las convenciones de nomenclatura de métodos de datos de primavera .

over 4 years ago · Santiago Trujillo Relatório

0

La consulta debería funcionar con

 @Query("{ 'student._id' : ?0} , 'excursionEvent._id' : ?1 } }")

Referencia: https://jira.spring.io/si/jira.issueviews:issue-html/DATAMONGO-1070/DATAMONGO-1070.html

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda