小编Dim*_*mon的帖子

无法实例化Pageable bean

我使用Spring 4.1.6.RELEASE和Spring Data Jpa 1.8.0.RELEASE.我有org.springframework.data.domain.Pageable bean创建的问题.它在我的控制器中使用:

@Controller
public class ItemsController {

    @Autowired
    ProductService itemsService;

    @RequestMapping(value = "/openItemsPage")
    public String openItemsPage() {
        return "items";
    }

    @RequestMapping(value = "/getItems", method = RequestMethod.GET)
    @ResponseBody
    public Item[] getItems(Pageable pageable) {

        return itemsService.getItems(pageable);
    }
}
Run Code Online (Sandbox Code Playgroud)

此外,我在我的应用程序上下文中有下一个xml配置:

<context:component-scan base-package="com.mobox.controller" />

<mvc:annotation-driven>
    <mvc:argument-resolvers>
        <beans:bean id="sortResolver"
                class="org.springframework.data.web.SortHandlerMethodArgumentResolver" />
        <beans:bean
                class="org.springframework.data.web.PageableHandlerMethodArgumentResolver">
            <beans:constructor-arg ref="sortResolver" />
        </beans:bean>
    </mvc:argument-resolvers>
</mvc:annotation-driven>
Run Code Online (Sandbox Code Playgroud)

最后,我做了客户的下一次重新计划:

   $.ajax({
        type: "GET",
        url: "getProducts?page=0&size=100",
        .....
Run Code Online (Sandbox Code Playgroud)

在tomcat日志中我看到下一个:

    SEVERE: Servlet.service() for servlet [appServlet] in context with path [/a2delivery-web] threw exception [Request processing …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-data-jpa

17
推荐指数
2
解决办法
1万
查看次数

Intellij-idea添加Maven插件

如何在intellij-idea中添加Maven插件?我想快速生成如下内容:

<build>
    <plugins>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>8.1.16.v20140903</version>
            <configuration>
                <stopKey>STOP</stopKey>
                <stopPort>8089</stopPort>
            </configuration>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

intellij-idea maven-plugin maven

6
推荐指数
2
解决办法
5万
查看次数

使用Hibernate的Postgresql:无法在jpql查询中确定LocalDate类型

我从hibernate-core迁移:4.3.11.Final到hibernate-core:5.2.10.Final因为我想在jpql中使用java 8 Date/Time APi中的LocalDate来获取参数,如下所示:

@Query("SELECT t FROM TransactionHistory t WHERE (t.account.id=:account)" + "AND (:dateFrom IS NULL OR t.date >= :dateFrom) AND (:dateTo IS NULL OR t.date <= :dateTo) order by t.date asc")
List<TransactionHistory> findByAccountIdAndDate(@Param("account") Long id,
                                                @Param("dateFrom") LocalDate from,
                                                @Param("dateTo") LocalDate to);
Run Code Online (Sandbox Code Playgroud)

在build.gradle文件中,我有下一个必要的依赖项:

compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.10.Final'
compile group: 'org.postgresql', name: 'postgresql', version: '42.1.1'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '1.4.0.RELEASE'
Run Code Online (Sandbox Code Playgroud)

当我运行服务器时,我得到下一个堆栈跟踪:

    org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet …
Run Code Online (Sandbox Code Playgroud)

java postgresql hibernate spring-data

4
推荐指数
2
解决办法
1457
查看次数

PostgreSQL - 从数据库转储中恢复一个表

如何从数据库转储中恢复一个表?我使用下一个命令进行转储:

pg_dump -U admin -h localhost my-db-name | gzip - > /home/a2_db_backup/my-db-name-backup.sql.gz
Run Code Online (Sandbox Code Playgroud)

postgresql

3
推荐指数
1
解决办法
1万
查看次数