darrachequesne / spring-data-jpa-datatables Goto Github PK
View Code? Open in Web Editor NEWSpring Data JPA extension to work with the great jQuery plugin DataTables (https://datatables.net/)
License: Apache License 2.0
Spring Data JPA extension to work with the great jQuery plugin DataTables (https://datatables.net/)
License: Apache License 2.0
Your salary range filter in advanced sample doesn't work. You need to disable searchable option of column you try to filter.
I have a web page that is configured with DataTables client side configuration, and needs to be converted to DataTables server side configuration. The DB we are using is MongoDB.
Any ideas as to how can I make this library work with MongoDB?
As of now findAll(DataTablesInput paramDataTablesInput, Specification paramSpecification); method, always ANDs paramSpecification in the criteria query.
How can I OR paramSpecification? Is there a workaround?
The origin datatables support regular search in column.search() method, but it seems not working with Datatables and will return an empty list with search. I noticed that the README file says filter with String Type will translate to "like'%%'",does it means the lib is not support regex search yet?
Thanks
java.lang.NoSuchMethodError: org.springframework.data.jpa.domain.Specification.where(Lorg/springframework/data/jpa/domain/Specification;)Lorg/springframework/data/jpa/domain/Specification;
at org.springframework.data.jpa.datatables.repository.DataTablesRepositoryImpl.findAll(DataTablesRepositoryImpl.java:67) ~[spring-data-jpa-datatables-5.0.0.jar:na]
at org.springframework.data.jpa.datatables.repository.DataTablesRepositoryImpl.findAll(DataTablesRepositoryImpl.java:27) ~[spring-data-jpa-datatables-5.0.0.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:520) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:505) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:477) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133) ~[spring-data-jpa-1.11.9.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at com.sun.proxy.$Proxy169.findAll(Unknown Source) ~[na:na]
at id.co.smartdata.elwins.Eelectronic.Winning.System.controller.TpsDatatablesController.dataTablesAllTps(TpsDatatablesController.java:31) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) ~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) ~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) ~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176) ~[spring-security-oauth2-2.0.14.RELEASE.jar:na]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.debug.DebugFilter.invokeWithWrappedRequest(DebugFilter.java:90) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.security.web.debug.DebugFilter.doFilter(DebugFilter.java:77) ~[spring-security-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.23.jar:8.5.23]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_161]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.23.jar:8.5.23]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_161]
I've been trying to use select extension with checkbox can you provide me with example.
I have this warning
DataTables warning: table id=items - Requested unknown parameter '4' for row 0, column 4. For more information about this error, please see http://datatables.net/tn/4
$(document).ready(function() {
$('#items').DataTable( {
"processing": true,
"serverSide": true,
"ajax":"/data/items",
"select" :{
style: "multi",
selector: 'td:last-child'
},
columns:[
{data : 'id'},
{data: 'name'},
{data: 'description'},
{data: 'action',
orderable : false,
searchable: false,
render: function(data, type,row){
return '<a href="/item/update/'+row.id+'">Update</a>'
}
},{
className : "select-checkbox",
orderable:false
}
]
} );
} );
Edit by owner: code format
Thank you for all of your hard work on this project -- it has proven extremely useful!
I have identified an issue where a hibernate QueryException is being thrown. I have a class with an @Embedded attribute that is camel-cased. The result is a "could not resolve property of..." error.
The reason for this error is because the field in the column data is being set to lower case. Therefore, instead of:
locomotive.locomotiveId.mark
I get:
locomotive.locomotiveid.mark
I downloaded your software, and removed "toLowerCase" in line 152 of DataTablesUtils.java:
.or(Expressions.stringOperation(Ops.STRING_CAST, entity.get(column.getData()))
The search capability started to work.
There appear to be other areas in this file where values are transformed into lower case. I have not looked closely enough to understand the implications removing these as well.
I am using QueryDSL.
Thank you for any insight, advice.
Best regards,
--Chris
I compare last version and 3.0, I find you forget to upload folder "paramter" , Are you Sure?
Is it possible to support the @Query
annotation? Or even better, to allow custom repository methods with this?
I am trying to get something like this working:
DataTablesOutput<Entity> findAllBySearch(SearchEntity search, DataTablesInput input);
Or with @Query
:
@Query("select e from entites where e.search = ?1")
DataTablesOutput<Entity> findAllBySearch(SearchEntity search, DataTablesInput input);
So search
is an attribute of entity
and I try to filter all entities by an search value.
I know, I can do this by Specifications or QueryDSL but does it work with normal spring repositories?
This behaviour would correlate with the default respoitories, like Page<Entity> findAllBySearch(SearchEntity search, Pageable pageble)
Searching with column value only plus "+" throws SQLException.
Query formed as "in ()".
Hi
I'm a bit new to coding. My question is the same as the title. I'm working on springboot+thymeleaf web project in my pom.xml
I have this.
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net-bs</artifactId>
<version>1.10.11</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net</artifactId>
<version>1.10.11</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net-responsive</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net-responsive-bs</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net-fixedheader</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net-fixedheader-bs</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net-buttons-bs</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net-buttons</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jszip</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net-keytable</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net</artifactId>
<version>1.10.11</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>datatables.net-bs</artifactId>
<version>1.10.11</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.30</version>
</dependency>
my controller code
@controller
public class PageController {
@GetMapping("/ss")
public String splainPage() {
return "ss";
}
}
later im gonna add list All users
and in my layout.html
I loaded all my css and js paths like this :
<!-- Bootstrap -->
<link href="/webjars/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="/webjars/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<!-- NProgress -->
<link href="/webjars/nprogress/nprogress.css" rel="stylesheet">
<!-- Datatables -->
<link href="/webjars/datatables.net-bs/css/dataTables.bootstrap.min.css" rel="stylesheet">
<link href="/webjars/datatables.net-responsive-bs/css/responsive.bootstrap.min.css" rel="stylesheet">
<link href="/webjars/datatables.net-fixedheader-bs/css/fixedHeader.bootstrap.min.css" rel="stylesheet">
<link href="/webjars/datatables.net-buttons-bs/css/buttons.bootstrap.min.css" rel="stylesheet">
<!-- Custom Theme Style -->
<link href="/css/custom.min.css" rel="stylesheet">
</head>
<!-- jQuery -->
<script src="/webjars/jquery/2.2.3/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="/webjars/bootstrap/js/bootstrap.min.js"></script>
<!-- Datatables -->
<script src="/webjars/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="/webjars/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script src="/webjars/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
<script src="/webjars/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
<script src="/webjars/datatables.net-buttons/js/buttons.flash.min.js"></script>
<script src="/webjars/datatables.net-buttons/js/buttons.html5.min.js"></script>
<script src="/webjars/datatables.net-buttons/js/buttons.print.min.js"></script>
<script src="/webjars/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
<script src="/webjars/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
<script src="/webjars/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
<script src="/webjars/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
<script src="/webjars/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
<script src="/webjars/jszip/dist/jszip.min.js"></script>
Everything is working fine except DataTables
features are not even showing up.
Console Files getting loaded :
Desired Result View : https://colorlib.com/polygon/gentelella/tables_dynamic.html
and I imported the right files according to https://datatables.net/examples/basic_init/zero_configuration.html
here is the code of layout.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title data-layout-title-pattern="$LAYOUT_TITLE | $CONTENT_TITLE">Smart Designer !</title>
<!-- Bootstrap -->
<link href="/webjars/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="/webjars/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<!-- NProgress -->
<link href="/webjars/nprogress/nprogress.css" rel="stylesheet">
<!-- Datatables -->
<link href="/webjars/datatables.net-bs/css/dataTables.bootstrap.min.css" rel="stylesheet">
<link href="/webjars/datatables.net-responsive-bs/css/responsive.bootstrap.min.css" rel="stylesheet">
<link href="/webjars/datatables.net-fixedheader-bs/css/fixedHeader.bootstrap.min.css" rel="stylesheet">
<link href="/webjars/datatables.net-buttons-bs/css/buttons.bootstrap.min.css" rel="stylesheet">
<!-- Custom Theme Style -->
<link href="/css/custom.min.css" rel="stylesheet">
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<div class="col-md-3 left_col menu_fixed">
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<a href="index.html" class="site_title"><i class="fa fa-paw"></i> <span>Smart Designer !</span></a>
</div>
<div class="clearfix"></div>
<!-- menu profile quick info -->
<div data-th-replace="fragments/fragment-menu-profile-quick-info :: menu-profile-quick-info"></div>
<!-- /menu profile quick info -->
<br/>
<!-- sidebar menu -->
<div data-th-replace="fragments/fragment-sidebar-menu :: sidebar-menu"></div>
<!-- /sidebar menu -->
<!-- /menu footer buttons -->
<!--<div data-th-replace="fragments/fragment-menu-footer-buttons :: menu-footer-buttons"></div>-->
<!-- /menu footer buttons -->
</div>
</div>
<!-- top navigation -->
<div data-th-replace="fragments/fragment-top-navigation :: top-navigation"></div>
<!-- /top navigation -->
<!-- page content -->
<div data-layout-fragment="content"></div>
<!-- /page content -->
<!-- footer content -->
<div data-th-replace="fragments/fragment-footer-content :: footer-content"></div>
<!-- /footer content -->
</div>
</div>
<!-- jQuery -->
<script src="/webjars/jquery/2.2.3/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="/webjars/bootstrap/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="/webjars/fastclick/fastclick.js"></script>
<!-- NProgress -->
<script src="/webjars/nprogress/nprogress.js"></script>
<!-- jquery.inputmask -->
<script src="/webjars/jquery.inputmask/min/jquery.inputmask.bundle.min.js"></script>
<script src="/webjars/inputmask/inputmask/bindings/inputmask.binding.js"></script>
<!-- Datatables -->
<script src="/webjars/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="/webjars/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script src="/webjars/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
<script src="/webjars/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
<script src="/webjars/datatables.net-buttons/js/buttons.flash.min.js"></script>
<script src="/webjars/datatables.net-buttons/js/buttons.html5.min.js"></script>
<script src="/webjars/datatables.net-buttons/js/buttons.print.min.js"></script>
<script src="/webjars/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
<script src="/webjars/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
<script src="/webjars/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
<script src="/webjars/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
<script src="/webjars/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
<script src="/webjars/jszip/dist/jszip.min.js"></script>
<!-- dataTables.responsive -->
<script src="/webjars/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
<script src="/webjars/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
<!-- Custom Theme Scripts -->
<script src="/js/custom.min.js"
here is the code of my html page :
<!DOCTYPE html>
<html lang="en" data-layout-decorate="~{fragments/layout}">
<head>
<title>Plain Page</title>
</head>
<body>
<div class="right_col" role="main" data-layout-fragment="content">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Plain Page</h3>
</div>
<div class="title_right">
<div
class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
<div class="input-group">
<input type="text" class="form-control"
placeholder="Search for..."> <span
class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Plain Page</h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i
class="fa fa-chevron-up"></i></a></li>
<li class="dropdown"><a href="#" class="dropdown-toggle"
data-toggle="dropdown" role="button" aria-expanded="false"><i
class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Settings 1</a></li>
<li><a href="#">Settings 2</a></li>
</ul></li>
<li><a class="close-link"><i class="fa fa-close"></i></a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>
Button Example <small>Users</small>
</h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i
class="fa fa-chevron-up"></i></a></li>
<li class="dropdown"><a href="#" class="dropdown-toggle"
data-toggle="dropdown" role="button" aria-expanded="false"><i
class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Settings 1</a></li>
<li><a href="#">Settings 2</a></li>
</ul></li>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<p class="text-muted font-13 m-b-30">The Buttons extension
for DataTables provides a common set of options, API methods
and styling to display buttons on a page that will interact
with a DataTable. The core library provides the based
framework upon which plug-ins can built.</p>
<table id="datatable-buttons"
class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012/03/29</td>
<td>$433,060</td>
</tr>
<tr>
<td>Airi Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>2008/11/28</td>
<td>$162,700</td>
</tr>
<tr>
<td>Brielle Williamson</td>
<td>Integration Specialist</td>
<td>New York</td>
<td>61</td>
<td>2012/12/02</td>
<td>$372,000</td>
</tr>
<tr>
<td>Herrod Chandler</td>
<td>Sales Assistant</td>
<td>San Francisco</td>
<td>59</td>
<td>2012/08/06</td>
<td>$137,500</td>
</tr>
<td>Singapore</td>
<td>29</td>
<td>2011/06/27</td>
<td>$183,000</td>
</tr>
<tr>
<td>Donna Snider</td>
<td>Customer Support</td>
<td>New York</td>
<td>27</td>
<td>2011/01/25</td>
<td>$112,000</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$('#datatable-buttons')
.addClass('table table-striped table-bordered');
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#datatable-buttons').DataTable();
} );
</script></body></html>
i already imported all css /scripts mentioned in the bottom that same html page apparently css /js files can call other ressources that are not mentioned in the bottom of of the needed html page
datatables column option's name and data is different,name is database model name, data is output josn attribute. but jpa query using data attribute, could you tell me how to using name for query? thanks
Hi,
I want to return VOs to client ,how to repalce Entity with VO with DataTablesRepository.
Thanks
Hi Darrachequese,
The first, my english is not very well, so maybe some thing i explain about your problem will make you confusing. I'm sorry about that.
I had use your library, but i think your library has some problem.
Your code:
// add JOIN FETCH when necessary
for (Column column : input.getColumns()) {
boolean isJoinable =
column.getSearchable() && column.getData().contains(ATTRIBUTE_SEPARATOR);
if (!isJoinable) {
continue;
}
String[] values = column.getData().split(ESCAPED_ATTRIBUTE_SEPARATOR);
PersistentAttributeType type =
root.getModel().getAttribute(values[0]).getPersistentAttributeType();
if (type != PersistentAttributeType.ONE_TO_ONE
&& type != PersistentAttributeType.MANY_TO_ONE) {
continue;
}
Fetch<?, ?> fetch = null;
for (int i = 0; i < values.length - 1; i++) {
fetch = (fetch == null ? root : fetch).fetch(values[i], JoinType.LEFT);
}
}
Right query: SELECT * FROM A a1 JOIN FETCH a1.b b1 WHERE (b1 has p1) AND (b1 has p2)
I resolved this by i convert all column into a tree. A tree will ensure no column duplicate. So i can make right query. But my code is not clean. I wish you improve your library. Some of my code. Hope you consider it to me
@Override
public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
List<Predicate> predicates = new ArrayList<Predicate>();
TreeDataTable tree = convertToTree(input.getColumns(), input.getOrder().get(0));
boolean isCountQuery = query.getResultType() == Long.class;
if (isCountQuery) {
predicates.add(cb.and(joinTree(root, cb, tree).toArray(new Predicate[] {})));
} else {
predicates.add(cb.and(fetchTree(root, query, cb, tree).toArray(new Predicate[] {})));
}
if(!subSpecs.isEmpty()) {
for(Specification<T> subSpec : subSpecs) {
predicates.add(cb.and(subSpec.toPredicate(root, query, cb)));
}
}
query.distinct(true);
return cb.and(predicates.toArray(new Predicate[] {}));
}
public List<Predicate> fetchTree(From<?, ?> from, CriteriaQuery<?> query, CriteriaBuilder builder,
TreeDataTable tree) {
List<Predicate> predicates = new ArrayList<Predicate>(0);
for (TreeDataTable treeChild : tree.getSubTrees()) {
boolean isHasChild = treeChild.isHasChild();
boolean isColumnOrderable = (StringUtils.hasText(treeChild.getHead().getDir()) && !isHasChild);
String treeName = treeChild.getHead().getName();
JoinType treeJoinType = treeChild.getHead().getJoinType();
Class classType = treeChild.getHead().getClassType();
HashMap<String, String> expressions = treeChild.getHead().getExpression();
if (isHasChild) {
Fetch<?, ?> subFetch = from.fetch(treeName, treeJoinType);
predicates.addAll(fetchTree((From<?, ?>) subFetch, query, builder, treeChild));
} else {
predicates.addAll(getPredicates(from, builder, treeName, classType, expressions));
if (isColumnOrderable) {
if (treeChild.getHead().getDir().equalsIgnoreCase("asc")) {
query.orderBy(builder.asc(from.get(treeName)));
} else {
query.orderBy(builder.desc(from.get(treeName)));
}
}
}
}
return predicates;
}
Edit: code style
**when use
factory-class="org.springframework.data.jpa.datatables.repository.DataTablesRepositoryFactoryBean"
it cause error as follows:**
Servlet.service() for servlet [jsp] in context with path [/mgr] threw exception [java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type avax/el/ExpressionFactory; used in the signature] with root cause java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type avax/el/ExpressionFactory; used in the signature
when remove factory-class="org.springframework.data.jpa.datatables.repository.DataTablesRepositoryFactoryBean"
it works!
I saw this issue:
Unfortunately the instructions never made it to the ReadMe. I'm in the process of using Spring Boot (along with it's JPA Data, and REST modules). With all of the lifting that Spring Boot does in this case most repositories are little more than annotated interfaces without a concrete implementation.
Any tips, tricks, or help in terms of how to get the datatables module configured and working alongside existing code would be extremely helpful. Currently I've tried a few of the approaches mentioned.
The context of course fails to load with the findAll method error mentioned in the initial issue above.
I then attempted to create a separate package, modified the package scan in the annotation, and added qualifiers to the interfaces (since with Spring Data, you're not defining implementations of the repository interfaces), and to the Autowiring annotations. Still no love - error with findAll not being found persisted.
Is it expected that this be able to work alongside, or as an adjunct to the existing Spring Data Rest capabilities.
Hi,
For the sake of efficiency, we've organised our code in such a way that we use the DataTablesRepository based on one entity (Petition), but we return a DataTablesOutput based on a different entity (PetitionResponse), with a subset of fields.
The project is open source, you can find the service that tries to get the data here: https://github.com/gov-ithub/petitii/blob/feature/pet-84_add_search_to_tables/src/main/java/ro/petitii/service/PetitionServiceImpl.java#L195
When using the DataTables to display all the data (nothing in the search box), it works fine. However, when I try to search, it returns a DataTablesOutput with no rows, but containing the following error:
java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [petitionerName] on this ManagedType [ro.petitii.model.Petition]
That makes sense, because the field names in the frontend are those of PetitionResponse and they don't match the field names in the Petition object.
However, when I remove searching on the non-existent fields from the frontend, it still doesn't search, it throws another exception (this time uncaught):
2017-01-25 14:57:29.991 ERROR 11486 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly] with root cause
javax.persistence.RollbackException: Transaction marked as rollbackOnly
Do you have any idea why the search does not work (in both cases) and how could I make it work?
Thanks,
Sorin.
Hi,
firstly I congrates you for a great job that you make, I search something like this.
But when I search on the function column(0).search(valueDate).draw() the Query search parameter is a varchar type on the date attribute. This result in nothing.
In debug log of hibernate the query is setting like this:
from movimento movimento0_ where 1=1 and (lower(cast(movimento0_.data as varchar(255))) like ? escape ?) order by movimento0_.data asc limit ?
the parameter are:
binding parameter [1] as [VARCHAR] - [%02/07/2017%]
binding parameter [2] as [CHAR] - []
Do you have searched a date type already?
What do you think about adding the jackson-datatype-jsr310 of reference to support the new date and time library of java 8?
https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310
Thank you!
when update spring-boot to 1.5.1.RELEASE
2017-02-07 20:47:34.038 INFO 2887 --- [main] c.eastseven.DemoWebDashboardApplication : Starting DemoWebDashboardApplication on D7.local with PID 2887 (/Users/dongqi/Dev/code/private/demo-web-dashboard/target/classes started by dongqi in /Users/dongqi/Dev/code/private/demo-web-dashboard)
2017-02-07 20:47:34.042 DEBUG 2887 --- [main] c.eastseven.DemoWebDashboardApplication : Running with Spring Boot v1.5.1.RELEASE, Spring v4.3.6.RELEASE
2017-02-07 20:47:34.043 INFO 2887 --- [main] c.eastseven.DemoWebDashboardApplication : No active profile set, falling back to default profiles: default
2017-02-07 20:47:34.777 INFO 2887 --- [main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2d2e5f00: startup date [Tue Feb 07 20:47:34 CST 2017]; root of context hierarchy
2017-02-07 20:47:36.564 INFO 2887 --- [main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-02-07 20:47:36.638 WARN 2887 --- [main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceInitializerPostProcessor': Unsatisfied dependency expressed through field 'beanFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountRepository': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
2017-02-07 20:47:36.643 ERROR 2887 --- [main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2d2e5f00: startup date [Tue Feb 07 20:47:34 CST 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:404) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1033) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at cn.eastseven.DemoWebDashboardApplication.main(DemoWebDashboardApplication.java:13) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
2017-02-07 20:47:36.644 ERROR 2887 --- [main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2d2e5f00: startup date [Tue Feb 07 20:47:34 CST 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:404) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1033) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at cn.eastseven.DemoWebDashboardApplication.main(DemoWebDashboardApplication.java:13) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
2017-02-07 20:47:36.649 ERROR 2887 --- [main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceInitializerPostProcessor': Unsatisfied dependency expressed through field 'beanFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountRepository': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:223) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:702) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:527) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at cn.eastseven.DemoWebDashboardApplication.main(DemoWebDashboardApplication.java:13) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accountRepository': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:240) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck(AbstractAutowireCapableBeanFactory.java:923) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:804) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:558) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:432) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:220) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1260) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
... 24 common frames omitted
when I use QDataTablesRepositoryFactoryBean and QDataTablesRepository
my code is simple jobRepository.findAll(input);
the page pass the parameters to filter datas, and I get the follow errors:
Hibernate: select job0_.id as id1_3_, job0_.batch_sequence as batch_se2_3_, job0_.cmd as cmd3_3_, job0_.consignee as consigne4_3_, job0_.create_time as create_t5_3_, job0_.data_size as data_siz6_3_, job0_.disk_sn as disk_sn7_3_, job0_.duration as duration8_3_, job0_.finish_time as finish_t9_3_, job0_.left_data_size as left_da10_3_, job0_.operator as operato11_3_, job0_.percentage as percent12_3_, job0_.remaining_time as remaini13_3_, job0_.slot_id as slot_id18_3_, job0_.speed as speed14_3_, job0_.start_time as start_t15_3_, job0_.status as status16_3_, job0_.submitter as submitt17_3_ from job job0_ order by job0_.id asc limit ?
Hibernate: select count(*) as col_0_0_ from job job0_
Hibernate: select count(job0_.id) as col_0_0_ from job job0_ where lower(cast(job0_.submitter as char)) like ? escape ''
2016-09-18 12:03:40.338 WARN 12333 --- [nio-8080-exec-5] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1064, SQLState: 42000
2016-09-18 12:03:40.339 ERROR 12333 --- [nio-8080-exec-5] o.h.engine.jdbc.spi.SqlExceptionHelper : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 1
2016-09-18 12:03:40.350 WARN 12333 --- [nio-8080-exec-5] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Warning Code: 1064, SQLState: 42000
2016-09-18 12:03:40.350 WARN 12333 --- [nio-8080-exec-5] o.h.engine.jdbc.spi.SqlExceptionHelper : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 1
2016-09-18 12:03:40.365 ERROR 12333 --- [nio-8080-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly] with root cause
javax.persistence.RollbackException: Transaction marked as rollbackOnly
at org.hibernate.jpa.internal.TransactionImpl.commit(TransactionImpl.java:74) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517) ~[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761) ~[spring-tx-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730) ~[spring-tx-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:485) ~[spring-tx-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291) ~[spring-tx-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodIntercceptor.invoke(CrudMethodMetadataPostProcessor.java:122) ~[spring-data-jpa-1.8.0.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at com.sun.proxy.$Proxy90.findAll(Unknown Source) ~[na:na]
at com.etc.test.datacastle.controller.JobRestController.list(JobRestController.java:55) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_72]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_72]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_72]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) ~[spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.2.3.RELEASE.jar:4.2.3.RELEASE]
Hi,
First of all, thanks for wonderful spring based solution for datatables.
Can you please provide an example for below situation.
Suppose I have OnetoMany relation in Employer/Employee.
What if I want to show all employees related to one employer only using employer id?
How do I configure Specification additionalSpecification with Employer id as PathVariable/Get Param? for example /abc/employees/{employerId} or /abc/employees?id=12312
Can we set employer Id each time request is sent to server in case of search and pagination?
I have many such cases in which a datatable need to be shown on page load.
Thanks in advance.
I am not able to implement where clause in it. It is working find in findAll() but i have to use where clause with Query. Please help me out on this.
This method does not returns enough rows in some cases:
public <R> DataTablesOutput<R> findAll(DataTablesInput input,
Specification<T> additionalSpecification, Specification<T> preFilteringSpecification,
Converter<T, R> converter)
For example: I use the jQuery DataTables with the Scroller plugin for displaying a list of 830 items. The scrolling zone has a dynamic height, thus a dynamic number of displayed rows. When I scroll down to the very bottom of the list, this request is sent to the server:
http://localhost:8080/myapp/users/results?draw=2&columns%5B0%5D.data=name&columns%5B0%5D.name=&columns%5B0%5D.searchable=true&columns%5B0%5D.orderable=true&columns%5B0%5D.search.value=&columns%5B0%5D.search.regex=false&order%5B0%5D.column=0&order%5B0%5D.dir=asc&start=749&length=81&search.value=&search.regex=false
in which we notice these parameters:
so the web client should receive the last 81 results, from indexes 749 to 829 (=749+81-1, because the first result's index is 0). Actually, it receives 81 results, but from indexes 729 to 810 ! Therefore, the displayed items are incorrect.
This bug seems to be located in the DataTablesUtils.getPageable method, at this row:
return new PageRequest(input.getStart() / input.getLength(), input.getLength(), sort);
Hello Damien,
I am working on the search, the last missing bit.
I had a look at your description here as well as at the a bit outdated one here and this one.
However, I can't get the search field to work as it should.
An exception gets thrown, which isn't to revealing for me.
I added a Specification class to handle the search parameter, but no luck.
So, how could a simple search over all fields be realised?
It would be great if the search worked in a generic way, on all members of type string for example.
Or can a dynamic method call such as DataTablesOutput<Meeting> findAllByTitle(DataTablesInput input, String title);
be used?
Kind regards, Tom
21:28:55 ERROR (DirectJDKLog.java:182) : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly] with root cause
javax.persistence.RollbackException: Transaction marked as rollbackOnly
at org.hibernate.jpa.internal.TransactionImpl.commit(TransactionImpl.java:74) ~[hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final]
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517) ~[spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757) ~[spring-tx-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726) ~[spring-tx-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521) ~[spring-tx-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291) ~[spring-tx-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:48) ~[metrics-spring-3.0.4.jar:na]
at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:34) ~[metrics-spring-3.0.4.jar:na]
at com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java:59) ~[metrics-spring-3.0.4.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) ~[spring-aop-4.1.7.RELEASE.jar:4.1.7.RELEASE]
How can I use different data for the different data types requested by DataTables (ex: filter, sort and display)? I have refer to https://datatables.net/reference/option/columns.data, and use data as :
"data": { "_": "phone", "filter": "phone_filter", "display": "phone_display" }
But, I got this error "java.lang.IllegalArgumentException: Property must not null or empty!".
Btw, thanks for this usefully library @darrachequesne ;)
Caused by: java.lang.NoClassDefFoundError: org/hibernate/jpa/criteria/path/AbstractPathImpl
at org.springframework.data.jpa.datatables.SpecificationBuilder$DataTablesSpecification.initPredicatesRecursively(SpecificationBuilder.java:51)
at org.springframework.data.jpa.datatables.SpecificationBuilder$DataTablesSpecification.toPredicate(SpecificationBuilder.java:28)
at org.springframework.data.jpa.domain.Specifications$ComposedSpecification.toPredicate(Specifications.java:190)
at org.springframework.data.jpa.domain.Specifications$ComposedSpecification.toPredicate(Specifications.java:190)
at org.springframework.data.jpa.domain.Specifications.toPredicate(Specifications.java:99)
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.applySpecificationToCriteria(SimpleJpaRepository.java:718)
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:649)
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:608)
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:407)
at org.springframework.data.jpa.datatables.repository.DataTablesRepositoryImpl.findAll(DataTablesRepositoryImpl.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:520)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:505)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:477)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy187.findAll(Unknown Source)
at amu.zhcet.core.dean.datatables.floated.FloatedDataTableController.getFloatedCourses(FloatedDataTableController.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
... 107 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.hibernate.jpa.criteria.path.AbstractPathImpl
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 153 common frames omitted
Hi, I have an issue similar to this one: adding @Transient
even to @Entity
field of simple type leads to DT warning/error :
DataTables warning: table id=users - java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [placesNum] on this ManagedType [com.kirak.domain.User]
, afer which DT renders no data AKA "No matching records found".
My sample field:
@JsonInclude //Tried to comment this
@JsonProperty("ownPlacesNum") //Tried to comment this
@JsonView(DataTablesOutput.View.class)
@Transient
private Integer ownPlacesNum;
I tried to play with getters and their annotations - still the same.
Though I really don't want to get rid of this awesome extension and have some workaround, this issue
brings a little headache as it becomes nearly impossible to ignore any kinds of entities' properties. Hope it may remind to come up with something. Thanks.
Hello Damien,
spring-data-jpa-datatables is just what I was looking for. I was about to implement a direct connector between datatables and a spring rest repository, when I found it.
I could run the example project and it works just fine. I'll post an enhancement for easier testing (CORS Headers) later on.
I'd like to integrate your approach into an existing app. I added the dependency and the annotation
@EnableJpaRepositories(repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class)
to the Application class.
When I start the application, an exception is thrown:
org.springframework.data.mapping.PropertyReferenceException: No property findAll found for type Meeting...
In the Interface @Repository public interface MeetingRepository extends PagingAndSortingRepository<Meeting, Long>
several method signatures exist, and I added a DataTablesOutput<Meeting> findAll(DataTablesInput input);
The app uses Spring Boot Starter 1.2.4 .
Any ideas why the discovery of the repository methods fails?
Can i use spring-data-jpa-datatables to oracle DB? I got exception.
[Request processing failed; nested exception is org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly] with root cause
javax.persistence.RollbackException: Transaction marked as rollbackOnly.
The current implementation works fine if the Specification
is applied to simple members of the domain classes. In metamodel vocabulary: If a search term should be matched against an attribute that is if type SetAttribute
instead of SingularAttribute
, the repository returns no matches.
A simple example might be domain classes Meeting
and Tag
, where Meeting
has @ManyToMany Set<Tag> tags
. If a user enters a search term 'foo' in the datatable, matches should take into account all meetings, where either meeting.description or one of meeting.tags[] has the value 'foo'.
The method toPredicate
in DataTablesSpecification<T>
might need to be adapted in way that it is capable to handle the occurence of the filter value in one of multiple tags assigned to the meeting.
Can you verify that this is not yet possible? What would be the right place to make the distinction of whether the attribute that is to be filtered is flat or a collection. And what are the appropriate predicates or cirteriaBuilder calls to make?
Quite a bit, for sure. The documentation on Advanced Spring Data JPA does not contain an example of this use case. If from your point of view it does not seem feasible to implement, it would be helpful to know to 😀 .
Currently, @manytoone relationships with QDataTablesRepository
break global search:
Server:
@Entity
public class User {
@Id private Integer id;
@ManyToOne
@JoinColumn(name = "id_address")
private Address address;
}
@Entity
public class Address {
@Id private Integer id;
}
Client:
$('table#users').DataTable({
columns : [ {
data : 'id'
}, {
data : 'address.id',
// searchable: false,
render: function(data, type, row) {
return data ? data : '';
}
}]
});
The countQuery
issued by QueryDslJpaRepository.findAll(Predicate predicate, Pageable pageable)
triggers the following query:
select count(user0_.id) as col_0_0_
from user_ user0_
cross join address address1_
where
user0_.id_address=address1_.id
and (lower(cast(user0_.id as char)) like ? escape '\'
or lower(cast(address1_.id as char)) like ? escape '\')
To add a proper LEFT JOIN
, an (ugly) workaround would be to manually add JPQLQuery countQuery = createQuery(predicate).leftJoin(entity.get("address"))
. But if someone has a better idea, I'm open to suggestions!
Update: since QueryDSL generates a leftJoin instead of an innerJoin when a sort is applied on the given column (ref), the following workaround works pretty well:
var table = $('table#users').DataTable({
orderFixed: [ <your-column-id>, 'asc' ],
});
Hi im trying to do a simple findall operation using spring-data-jpa-datatables. I'm getting this excpetion saying "Position beyond number of declared ordinal parameters". Can anyone help me on the same?
here my controller code :
@RequestMapping(value = { "/reports/patient" }, method = RequestMethod.POST, produces = {
"application/json" }, consumes ={"application/json" })
public DataTablesOutput<PatientDetailsDto> patientReport(@RequestBody DataTablesInput input) throws ApplicationException {
DataTablesOutput<PatientDetailsDto> result = new DataTablesOutput<>();
try{
DataTablesOutput<PatientDetail> paTablesOutput = patientRepository.findAll(input);
List<PatientDetailsDto> roomList = null;
processRoomList(roomList, paTablesOutput.getData());
result.setData(roomList);
result.setDraw(paTablesOutput.getDraw());
result.setError(paTablesOutput.getError());
result.setRecordsFiltered(paTablesOutput.getRecordsFiltered());
result.setRecordsTotal(paTablesOutput.getRecordsTotal());
}
catch (Exception e) {
System.out.println(e.getMessage());
}
return result;
}
the input looks like this :
DataTablesInput [draw=1, start=0, length=9, search=SearchParameter [value=, regex=false], order=[OrderParameter [column=0, dir=asc]], columns=[ColumnParameter [data=room_number, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=mrn, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=fname, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=mname, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=lname, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=status, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=checkin, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=checkout, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=extension, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=member1, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=memberExt1, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=member2, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=memberExt2, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=member3, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=memberExt3, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=member4, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=memberExt4, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=member5, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=memberExt5, name=, searchable=true, orderable=true, search=SearchParameter [value=, regex=false]], ColumnParameter [data=null, name=, searchable=true, orderable=false, search=SearchParameter [value=, regex=false]]]]
Hello,
I wanna query datas from two tables not all datas with SQL and display result on datatables ,such as "select a.title,b.name from table_a as a, table_b as b where a.id=b.aid". These two tables don't have one to one or many to one relationship. I googled it but I didn't find an answer. Can you tell me is it possible to implement with spring-data-jpa-datatables? Thank you very much.
I was wondering if it works with datatable editor.
Thanks.
Absence of @JSONVIEW(DataTablesOutput.View.class) does not hide the property. - That's pretty much the issue. Putting it back and removing it again does not affect visibility of any property - i tried.
Hello,
I have some @transient field in my domain class like this:
...
@Transient
@JsonView(DataTablesOutput.View.class)
private OsebaVerzija zadnjaOsebaVerzija;
public OsebaVerzija getZadnjaOsebaVerzija() {
return Collections.max(osebaVerzije, new OsebaVerzijaComp());
}
...
after running my app I get exception in code:
...
DataTablesOutput<Oseba> osebas = dtOsebaRepository.findAll(input);
...
Exit: com.test.app.web.rest.OsebaResource.getAllOsebaVerzija() with result = DataTablesOutput [draw=1, recordsTotal=22, recordsFiltered=0, error=java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [zadnjaOsebaVerzija] on this ManagedType [com.test.app.domain.Oseba]]
Please add support to query DSL 💃
How to apply server side filtering? findAll
obviously returns all columns, but there seems to be no way other than creating a whole new object to remove columns from the result. I tried messting around with the DataTablesInput
object in my controller, but this didn't change the result.
Could you please help me out?
How to request resource from Oauth2 resource server?
I have tried
ajax: '/api/errorlog/all',
serverSide: true,
processing: true,
And give following error
{error: "unauthorized", error_description: "Full authentication is required to access this resource"} error : "unauthorized" error_description : "Full authentication is required to access this resource"
Note : I use spring boot with thymeleaf and try to request after authenticated.
Hi,
I have an entity
Order
{
@Id
@GeneratedValue
@Column(name="order_id")
private BigInteger orderId;
@OneToMany(mappedBy = "order")
private Set<OrderLine> orderLines;
}
and bi-directional mapping in entity
OrderLine
{
@Id
@Column(name="order_id")
@GeneratedValue(generator="gen")
@GenericGenerator(name="gen", strategy="foreign", [email protected](name="property", value="order"))
private BigInteger orderId;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "order_id", updatable = false, insertable = false)
@JsonIgnore
private Order order;
}
My order repository extends the DataTablesRepository interface. When I had OneToOne mapping the results were fast and the HQL generated had LIMIT in the query. But with the above mapping LIMIT is missing in the query and it takes a long time to fetch all records and then do in memory mapping to return the paginated result.
It's been more than 3 weeks I am trying to find a work around but not able to figure out how. Can you suggest how can I solve this issue.
when i use it on embed tomact the javax.el-api was conflict with tomcat-embed-el.
Since mybatis3 is more popular than Spring-data-jpa,
so how to conver this project to mybatis?
THKS。
Hi,
I am trying to search a column with server side processing enabled. Regex search works without server side processing. I have a list of strings and want to do a search using regex string on a specific column, example regex : '^str1|str2|str3|^str4$'.
I am sending the columns[index].search.regex=true with it's corresponding value columns[index].search.value=myregex, I find no results. But it works for non-regex individual values. Am I missing anything ?
Thanks in advance !
I met this problem,but I don't know why.
Hi,
One more question.
How to handle Set in DataTablesOutput,I found that set is empty in rest response.
Thanks
estudiante.dtOptions = DTOptionsBuilder.newOptions()
.withOption('ajax', {
contentType: 'application/json',
url: 'CALIFICACIONES/datatablepost',
type: 'POST',
data: function (d) {
return JSON.stringify(d);
}
})
.withDataProp('data')
.withOption('serverSide', true)
.withPaginationType('full_numbers');
estudiante.dtColumns = [
DTColumnBuilder.newColumn('matricula').withTitle('Matrícula'),
DTColumnBuilder.newColumn('persona.apellidoPaterno').withTitle('A. Paterno'),
DTColumnBuilder.newColumn('persona.apellidoMaterno').withTitle('A. Materno'),
DTColumnBuilder.newColumn('persona.nombre').withTitle('Nombre'),
DTColumnBuilder.newColumn('semestre').withTitle('Semestre'),
DTColumnBuilder.newColumn('grupo').withTitle('Grupo'),
DTColumnBuilder.newColumn('promedioGeneral').withTitle('Promedio general').withClass('text-right'),
DTColumnBuilder.newColumn('').withTitle('Acciones').notSortable().renderWith(actionsHtml)
];
@JsonView(DataTablesOutput.View.class)
@RequestMapping(path = "/datatablepost", method = RequestMethod.POST)
public DataTablesOutput<Estudiante> getAllEStudiat(@Valid @RequestBody DataTablesInput input) {
log.info("<<==================== DATATABLE ====================>>");
log.info(input.toString());
DataTablesOutput<Estudiante> ee = new DataTablesOutput<>();
ee = dataTable.findAll(input);
log.info(ee);
return ee;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.