小编use*_*679的帖子

冬眠中的魔法npe

当我写作

Session session = sessionFactory.getCurrentSession();
List<Candidate> candidates = (List<Candidate>) session.createQuery(
        "select Candidate from Candidate as candidate  left outer join"
        + " candidate.skills as skill    where skill.id =" + 1).list();
Run Code Online (Sandbox Code Playgroud)

我已经在第二线了

如果我写

Session session = sessionFactory.getCurrentSession();
List<Candidate> candidates = (List<Candidate>) session.createSQLQuery(
        "select candidate.* from candidate inner join candidate_skill"
        + " on candidate.id = candidate_skill.candidate_id"
        + " inner join skill on candidate_skill.skill_id = skill.id"
        + " where skill.id = 1").list();
Run Code Online (Sandbox Code Playgroud)

我有好结果

为什么我在第一个例子中有NPE?

严重:Servlet [appServlet]的Servlet.service()在路径[/ ui]的上下文中引发异常[请求处理失败; 嵌套异常是java.lang.NullPointerException],原因是org.hibernate.dialect.function.SQLFunctionRegistry.findSQLFunction(SQLFunctionRegistry.java:41)中的根本原因java.lang.NullPointerException

在此输入图像描述

java hibernate hql

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

视窗.如何添加PermGen空间?

如何在Windows中为jvm添加PermGen空间?我发现很多关于它的链接?但我不明白我必须点击并写下新值

java windows permgen

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

java.lang.ClassCastException:org.hibernate.internal.SQLQueryImpl无法强制转换为java.util.List如何修复

 List<Candidate> candidates = (List<Candidate>) session.createSQLQuery("select candidate.* from candidate inner join candidate_skill on candidate.id = candidate_skill.candidate_id inner join skill on candidate_skill.skill_id = skill.id where skill.id = 1");       
Run Code Online (Sandbox Code Playgroud)

我明白了:

 java.lang.ClassCastException: org.hibernate.internal.SQLQueryImpl cannot be cast to java.util.List
Run Code Online (Sandbox Code Playgroud)

查询是正确的.怎么解决?

java sql hibernate exception

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

使用spring security从jsp访问userName

如果他登录我想输出userName.来自@Controller我有权访问:

@RequestMapping("/success")
    public String success(Model model) {
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        String name = auth.getName(); //get logged in username
        model.addAttribute("name", name);
        return "success";
    }
Run Code Online (Sandbox Code Playgroud)

它工作如果我在jsp上使用名称,我看到键入的名称.

但如果在这个jsp我写

 <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
    <sec:authentication property="principal.username"/>
Run Code Online (Sandbox Code Playgroud)

我得到stackTrace:

 INFO : com.epam.hhsystem.util.CustomAuthentificationProvider - User with name 'Nikolay_Tkachev' log in
07.08.2013 17:00:57 org.apache.jasper.compiler.TldLocationsCache tldScanJar
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were …
Run Code Online (Sandbox Code Playgroud)

exception spring-security

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

标签 统计

java ×3

exception ×2

hibernate ×2

hql ×1

permgen ×1

spring-security ×1

sql ×1

windows ×1