当我写作
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

如何在Windows中为jvm添加PermGen空间?我发现很多关于它的链接?但我不明白我必须点击并写下新值
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)
查询是正确的.怎么解决?
如果他登录我想输出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)