小编lio*_*nyu的帖子

Spring Data JPA存储库方法无法识别带下划线的属性名称

我在实体属性名称中有下划线,当Spring尝试创建JPA存储库实现时,它会导致尝试解析属性名称的异常.

实体:

@Entity
public class Student {
      @Id
      private String s_id;
      private String s_name;
      ...
}
Run Code Online (Sandbox Code Playgroud)

库:

 @Repository
 @Transactional
 public interface StudentRepository extends CrudRepository<Student, String> {

       List<Student> findByS__name(String name);

}
Run Code Online (Sandbox Code Playgroud)

例外:

org.springframework.data.mapping.PropertyReferenceException: 
No property s found for type Student
Run Code Online (Sandbox Code Playgroud)

这里说http://docs.spring.io/spring-data/jpa/docs/current/reference/html/

如果您的属性名称包含下划线(例如first_name),则可以使用第二个下划线转义方法名称中的下划线.对于first_name属性,查询方法必须命名为findByFirst__name(...).

我只是按照文件说的那样做,但我仍然有例外.我不想@Query自己写,我需要在我的属性名称下划线,如何解决这个问题?

我使用Spring数据jpa 1.8.0.RELEASE + hibernate 4.3.9.Final

spring-data-jpa

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

如何在Visual Studio Code for html中显示console.log输出?

当我使用括号时,有一个插件console.log在源代码面板下面的面板中显示输出,所以我不需要切换到chrome并按F12查看console.log输出.

但是如何在Visual Studio Code中做到这一点?

我使用Visual Studio代码的HTML发展不Node.js的.

visual-studio-code

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

Python2.7异常“如果程序,则可以省略“ freeze_support()”行”

import Queue
from multiprocessing.managers import BaseManager

BaseManager.register('get_queue', callable=lambda:  Queue.Queue())

manager = BaseManager(address=('', 5000), authkey='abc')
manager.start()
manager.shutdown()
Run Code Online (Sandbox Code Playgroud)

此代码将引发异常

RuntimeError: 
        Attempt to start a new process before the current process
        has finished its bootstrapping phase.

        This probably means that you are on Windows and you have
        forgotten to use the proper idiom in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce a Windows executable. …
Run Code Online (Sandbox Code Playgroud)

python

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