Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Josh Hays opened DATAREST-1216 and commented
PATCH does not work with spring-data-jpa and openjpa. I found a workaround for DELETE using a custom converter:
@Component public class OpenJpaStringIdConverter implements Converter<StringId, String> { private static final Logger LOG = LoggerFactory.getLogger(OpenJpaStringIdConverter.class); @Override public String convert(StringId source) { if (LOG.isDebugEnabled()) { LOG.debug("OpenJpaStringIdConverter - convert: StringId={} to String={}", source, source.getId()); } return source.getId(); } }
The converter is added this way:
@Configuration public class RestConfiguration extends RepositoryRestConfigurerAdapter { private static final Logger LOG = LoggerFactory.getLogger(RestConfiguration.class); @Override public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { config.exposeIdsFor(new Class[] { Operator.class, Device.class, Flight.class, Message.class, Tail.class }); } @Override public void configureConversionService(ConfigurableConversionService conversionService) { super.configureConversionService(conversionService); if (LOG.isDebugEnabled()) { LOG.debug("Adding custom converter for org.apache.openjpa.util.StringId to java.lang.String"); } conversionService.addConverter(new OpenJpaStringIdConverter()); } }
There seems to be a different mechanism for PATCH and PUT within the following class:
org.springframework.data.rest.webmvc.config.PersistentEntityResourceHandlerMethodArgumentResolver
Am I missing something simple, or does this not work as intended?
The exception is as follows:
ERROR o.s.d.r.w.RepositoryRestExceptionHandler - Cannot cast org.apache.openjpa.util.StringId to java.lang.String
Affects: 2.6.10 (Ingalls SR10)
Reference URL: https://stackoverflow.com/questions/49244526/patch-and-delete-failing-with-spring-data-jpa-and-openjpa
The text was updated successfully, but these errors were encountered:
odrotbohm
No branches or pull requests
Josh Hays opened DATAREST-1216 and commented
PATCH does not work with spring-data-jpa and openjpa. I found a workaround for DELETE using a custom converter:
The converter is added this way:
There seems to be a different mechanism for PATCH and PUT within the following class:
Am I missing something simple, or does this not work as intended?
The exception is as follows:
Affects: 2.6.10 (Ingalls SR10)
Reference URL: https://stackoverflow.com/questions/49244526/patch-and-delete-failing-with-spring-data-jpa-and-openjpa
The text was updated successfully, but these errors were encountered: