出于个人原因,我在同一个实体中有多个存储库,而我需要多个本地命名查询,我的第一个想法是将查询代码从实体移动到存储库中,因此当我要编辑查询时会找到它在存储库中不是实体(以避免充斥大量查询的大型实体代码)。
所以我尝试了这种实现。
此我的存储库:
@SqlResultSetMappings({ @SqlResultSetMapping(name = TypeProduitRepository.REPOSITORY_SELECT_MAPPING, columns = {
@ColumnResult(name = "code", type = Long.class), @ColumnResult(name = "description", type = String.class),
@ColumnResult(name = "valeur_decimal", type = Double.class),
@ColumnResult(name = "valeur_entier", type = Long.class),
@ColumnResult(name = "valeur_alpha_num", type = String.class) }) })
@NamedNativeQueries({
@NamedNativeQuery(
name = TypeProduitRepository.REPOSITORY + ".select",
query =
"SELECT "
+ "rp.parcin AS code,"
+ "rp.pardesc AS description, "
+ "rp.parvald AS valeur_decimal,"
+ "rp.parvall AS valeur_entier, "
+ "rp.parvals AS valeur_alpha_num\r\n"
+ "FROM ref_param rp\r\n"
+ "WHERE rp.partab = "+TypeProduitRepository.TABLE_CODE+" AND rp.donord = \"mds\";",
resultSetMapping = TypeProduitRepository.REPOSITORY_SELECT_MAPPING),
@NamedNativeQuery(
name = TypeProduitRepository.REPOSITORY + ".insert",
query =
"INSERT INTO `ref_param` "
+ "( `partab`, `derprg`, `deruser`, `donord`, `indicmaj`, `indtrans`, `pardesc`, `parvald`, `parvall`, `parvals`)"
+ " VALUES " + "( "+TypeProduitRepository.TABLE_CODE+", :derprg, :deruser, :donord, 0, 0, :pardesc, :parvald, :parvall, :parvals);"
+ "\r\n" + ""),
@NamedNativeQuery(
name = TypeProduitRepository.REPOSITORY + ".update",
query =
"UPDATE ref_param \r\n"
+ "SET \r\n"
+ " datmaj = NOW() -- datmaj - DATE NOT NULL\r\n"
+ " ,derprg = :derprg -- derprg - VARCHAR(13) NOT NULL\r\n"
+ " ,deruser = :deruser -- deruser - VARCHAR(13) NOT NULL\r\n"
+ " ,donord = :donord -- donord - VARCHAR(13) NOT NULL\r\n"
+ " ,indicmaj = indicmaj+1 -- indicmaj - BIGINT(20)\r\n"
+ " ,pardesc = :pardesc -- pardesc - VARCHAR(255) NOT NULL\r\n"
+ " ,parvald = :parvald -- parvald - DOUBLE\r\n"
+ " ,parvall = :parvall -- parvall - BIGINT(20)\r\n"
+ " ,parvals = :parvals -- parvals - VARCHAR(255)\r\n"
+ "WHERE\r\n"
+ " parcin = :parcin -- parcin - BIGINT(20) NOT NULL\r\n"
+ " AND partab = "+TypeProduitRepository.TABLE_CODE+" -- partab - BIGINT(20) NOT NULL\r\n ;" ),
@NamedNativeQuery(
name = TypeProduitRepository.REPOSITORY + ".incerementInd",
query =
"UPDATE ref_param \r\n"
+ "SET \r\n"
+ " indtrans = indtrans+1 -- datmaj - DATE NOT NULL\r\n"
+ "WHERE\r\n"
+ " parcin = :parcin -- parcin - BIGINT(20) NOT NULL\r\n"
+ " AND partab = "+TypeProduitRepository.TABLE_CODE+" -- partab - BIGINT(20) NOT NULL\r\n ;" ),
@NamedNativeQuery(
name =TypeProduitRepository.REPOSITORY + ".delete",
query=
"DELETE FROM pos_auth.ref_param\r\n" +
"WHERE\r\n" +
" parcin = :parcin -- parcin - BIGINT(20) NOT NULL\r\n" +
" AND partab = "+TypeProduitRepository.TABLE_CODE+" -- partab - BIGINT(20) NOT NULL"
)
})
@Repository
public interface TypeProduitRepository extends JpaRepository<ReferencielParamettre, ReferencielParamettreID> {
public static final String REPOSITORY = "ReferencielParamettre.TypeProduitRepository";
public static final String REPOSITORY_SELECT_MAPPING = "ReferencielParamettre.TypeProduit";
public static final String TABLE_CODE = "1004";
@Query(name =REPOSITORY+".select" ,nativeQuery = true)
public List<TypeProduit> select();
@Transactional
@Modifying
@Query(name =REPOSITORY+".insert" ,nativeQuery = true)
public int insert( String derprg, String deruser, String donord, String pardesc, Double parvald, Long parvall, String parvals);
@Transactional
@Modifying
@Query(name =REPOSITORY+".update" ,nativeQuery = true)
public int update(Long parcin, String derprg, String deruser, String donord, String pardesc, Double parvald, Long parvall, String parvals);
@Transactional
@Modifying
@Query(name =REPOSITORY+".incerementInd" ,nativeQuery = true)
public int incerementInd(Long parcin);
@Transactional
@Modifying
@Query(name =REPOSITORY+".delete" ,nativeQuery = true)
public int delete(Long parcin);
}
接下来这是我的实体:
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = "REF_PARAM")
@IdClass(ReferencielParamettreID.class)
@Check(constraints = "PARVALS IS NOT NULL OR PARVALD IS NOT NULL OR PARVALL IS NOT NULL ")
public class ReferencielParamettre extends CommonData implements Serializable {
/**
*
*/
private static final long serialVersionUID = -7744229498316267737L;
/**
* partab Number code interne table parametre X N 1080 table de unite de mesure
*/
@Id
private Long partab;
/**
* parcin Number code interne parametre X N code 1 pour CM
*/
@Id
private Long parcin;
/**
* pardesc Varchar description du parametre X N par exemple : cm, centimetre
* affichage
*/
@Column(nullable = false)
private String pardesc;
/**
* parvall Number valeur entiere du parametre X Y par exemple coeficiant dual en
* mode affichage devrai avoir la valeur 2
*/
@Column(nullable = true)
private Long parvall;
/**
* parvald Number(5.2) valeur flotante du parametre X N par exemple Pi en
* affichage vaux 3.14
*/
@Column(nullable = true)
private Double parvald;
/**
* parvals VARCHAR valeur charactere du parametre X N par exemple pme vaux
* petite moyenne entreprise: possible utile dans l'impression d'une facture
*/
@Column(nullable = true)
private String parvals;
}
启动时,确实出现以下异常:
org.springframework.beans.factory.BeanCreationException:创建名称为'typeProduitRepository'的bean时出错:调用init方法失败;嵌套异常为java.lang.IllegalArgumentException:无法为方法public abstract int mds.ref.common.repository.TypeProduitRepository.update(java.lang.Long,java.lang.String,java.lang.String,java。 lang.String,java.lang.String,java.lang.Double,java.lang.Long,java.lang.String)!找不到类型为ReferencielParamettre的属性更新!
这是完整的堆栈跟踪:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Factory method 'requestMappingHandlerAdapter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConversionService' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'typeProduitRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract int mds.ref.common.repository.TypeProduitRepository.update(java.lang.Long,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.Double,java.lang.Long,java.lang.String)! No property update found for type ReferencielParamettre!
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1250) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at mds.ResourceApplication.main(ResourceApplication.java:28) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.1.RELEASE.jar:2.0.1.RELEASE]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Factory method 'requestMappingHandlerAdapter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConversionService' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'typeProduitRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract int mds.ref.common.repository.TypeProduitRepository.update(java.lang.Long,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.Double,java.lang.Long,java.lang.String)! No property update found for type ReferencielParamettre!
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
... 23 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConversionService' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'typeProduitRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract int mds.ref.common.repository.TypeProduitRepository.update(java.lang.Long,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.Double,java.lang.Long,java.lang.String)! No property update found for type ReferencielParamettre!
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1250) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:392) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:364) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$2afbee97.mvcConversionService(<generated>) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.getConfigurableWebBindingInitializer(WebMvcConfigurationSupport.java:604) ~[spring-webmvc-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.getConfigurableWebBindingInitializer(WebMvcAutoConfiguration.java:524) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.requestMappingHandlerAdapter(WebMvcConfigurationSupport.java:566) ~[spring-webmvc-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.requestMappingHandlerAdapter(WebMvcAutoConfiguration.java:467) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$2afbee97.CGLIB$requestMappingHandlerAdapter$6(<generated>) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$2afbee97$$FastClassBySpringCGLIB$$1ba8ac87.invoke(<generated>) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$2afbee97.requestMappingHandlerAdapter(<generated>) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
... 24 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'typeProduitRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract int mds.ref.common.repository.TypeProduitRepository.update(java.lang.Long,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.Double,java.lang.Long,java.lang.String)! No property update found for type ReferencielParamettre!
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
... 49 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'typeProduitRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract int mds.ref.common.repository.TypeProduitRepository.update(java.lang.Long,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.Double,java.lang.Long,java.lang.String)! No property update found for type ReferencielParamettre!
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1095) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.data.repository.support.Repositories.cacheRepositoryFactory(Repositories.java:96) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
at org.springframework.data.repository.support.Repositories.populateRepositoryFactoryInformation(Repositories.java:89) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
at org.springframework.data.repository.support.Repositories.<init>(Repositories.java:82) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
at org.springframework.data.repository.support.DomainClassConverter.setApplicationContext(DomainClassConverter.java:109) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
at org.springframework.data.web.config.SpringDataWebConfiguration.addFormatters(SpringDataWebConfiguration.java:130) ~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]
at org.springframework.web.servlet.config.annotation.WebMvcConfigurerComposite.addFormatters(WebMvcConfigurerComposite.java:81) ~[spring-webmvc-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration.addFormatters(DelegatingWebMvcConfiguration.java:78) ~[spring-webmvc-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.mvcConversionService(WebMvcAutoConfiguration.java:495) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$2afbee97.CGLIB$mvcConversionService$8(<generated>) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$2afbee97$$FastClassBySpringCGLIB$$1ba8ac87.invoke(<generated>) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$2afbee97.mvcConversionService(<generated>) ~[spring-boot-autoconfigure-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
... 50 common frames omitted
Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract int mds.ref.common.repository.TypeProduitRepository.update(java.lang.Long,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.Double,java.lang.Long,java.lang.String)! No property update found for type ReferencielParamettre!
答案 0 :(得分:0)
在Deinum先生的评论中提到
结果映射等仅适用于实体或实体包,不适用于任何任意对象。
如果不在实体中是不可能的