小编war*_*gre的帖子

Doctrine2使用setParameters

当我似乎在我的查询中使用参数时,我收到一个错误

参数号无效:绑定变量数与令牌数不匹配

这是我的代码

public function GetGeneralRatingWithUserRights($user, $thread_array)
{
    $parameters = array(
        'thread' => $thread_array['thread'],
        'type' => '%'.$thread_array['type'].'%'
    );

    $dql = 'SELECT p.type,AVG(p.value) 
        FROM TrackerMembersBundle:Rating p 
        GROUP BY p.thread,p.type';

    $query = $this->em->createQuery($dql)
        ->setParameters($parameters);

    $ratings = $query->execute();

    return $ratings;
}
Run Code Online (Sandbox Code Playgroud)

如何正确配置参数数组?

sql symfony doctrine-orm

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

将文本值放在轴而不是数值上

我在python 3.2中创建了一个简单的单词频率计算器.现在我想创建一个可视化结果的图.x轴将包含频率结果,我想将最频繁的单词添加到y轴.如何在pylab轴上添加文本而不是数字?提前致谢!

python matplotlib

7
推荐指数
1
解决办法
7958
查看次数

Spring Boot Kotlin API 为所有端点返回 404 响应

我将 Spring Boot 与 Kotlin 结合使用。其余控制器为所有端点返回 404 错误。在启动日志中,控制器中的端点不存在。任何端点都会返回相同的 404 响应。

这些是我尝试过的步骤,

  1. 尝试清除缓存/目标
  2. 将所有类移至单个目录中
  3. 尝试添加 ComponentScan 注释,但不被接受。
  4. 我正在使用 cmd 行来运行该项目
  5. 运行 java -jar $jarfile 时看到的输出相同
  6. 检查注释 Repository , Service , RestController

控制器:

package com.example.controller

import org.springframework.web.bind.annotation.RestController
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.RequestBody

import Cricketer
import CricketerRepository
import CricketerService
import org.springframework.web.bind.annotation.RequestMapping

@RestController
@RequestMapping("/api")
class CricketerController(private val cricketerService: CricketerService , private val cricketerRepository: CricketerRepository){

    @GetMapping("/cricketers/{id}")
    fun getCricketer(@PathVariable("id") id: Long):ResponseEntity<Cricketer>  {
        val cricketer = …
Run Code Online (Sandbox Code Playgroud)

java kotlin spring-boot

5
推荐指数
1
解决办法
4561
查看次数

标签 统计

doctrine-orm ×1

java ×1

kotlin ×1

matplotlib ×1

python ×1

spring-boot ×1

sql ×1

symfony ×1