考虑以下型号:
@Entity
public class User {
@Id
@Column(name = "USER_ID")
private Long userId;
@Column(name = "FIRST_NAME")
private String firstName;
@Column(name = "LAST_NAME")
private String lastName;
@OneToOne
@PrimaryKeyJoinColumn
private UserExt userExt;
... //getters and setters
}
@Entity
public class UserExt {
@Id
@Column(name="USER_ID")
private Long id;
private String cdpId;
private Date lastChanged;
... //getters and setters
}
Run Code Online (Sandbox Code Playgroud)
执行时:
Query query = session.createQuery("from User");
List<User> list = query.list();
Run Code Online (Sandbox Code Playgroud)
Hibernate执行
Hibernate: select user0_.USER_ID as USER1_0_, user0_.FIRST_NAME as FIRST2_0_, user0_.LAST_NAME as LAST3_0_, user0_.EXT_USERNAME as …Run Code Online (Sandbox Code Playgroud) 我想在xml文档中添加一个元素,我想将参数作为参数传递给元素.
sample.xml文件:
<?xml version="1.0"?>
<stuff>
<element1>
<foo>2</foo>
<bar/>
</element1>
<element2>
<subelement/>
<bar/>
</element2>
<element1>
<foo/>
<bar/>
</element1>
</stuff>
Run Code Online (Sandbox Code Playgroud)
使用:
xalan.exe -p myparam "element1" sample.xml addelement.xslt
Run Code Online (Sandbox Code Playgroud)
我想得到以下结果:
<?xml version="1.0"?>
<stuff>
<element1>
<foo>2</foo>
<bar/>
<addedElement/>
</element1>
<element2>
<subelement/>
<bar/>
</element2>
<element1>
<foo/>
<bar/>
<addedElement/>
</element1>
</stuff>
Run Code Online (Sandbox Code Playgroud)
我已经设法编写addelement.xslt,当硬编码它的工作路径时,但是当我尝试在match属性中使用参数myparam时,我得到:
XPathParserException: A node test was expected.
pattern = '$myparam/*[last()]' Remaining tokens are: ('$' 'myparam' '/' '*' '[' 'last' '(' ')' ']') (addelement.xslt, line 12, column 42)
Run Code Online (Sandbox Code Playgroud)
addelement.xslt
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()"> …Run Code Online (Sandbox Code Playgroud) 我有很多用于构建/打包的Web应用程序,我想分享他们的公共库.
关于日志记录,我想将slf4j-api与每个应用程序捆绑在一起,但考虑我的容器(当前是tomcat)提供的实现
为此,我将两个jar,logback-classic和logback-core复制到$ CATALINA\lib目录中.
不幸的是,在运行时,slf4j与其实现之间的绑定失败,并显示以下错误消息:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Run Code Online (Sandbox Code Playgroud)
我设法使它工作的唯一方法是在战争文件中捆绑jar.
有任何想法吗?
考虑以下"模型":
USER
Long: PK
String: firstName
String: lastName
USER_EXT
Long: PK
String: moreInfo
Date: lastModified
Run Code Online (Sandbox Code Playgroud)
我正在尝试查找/创建正确的Hibernate映射(使用Annotations),这样,使用HQL查询就像"来自用户"一样简单,它将生成以下SQL:
select firstName, moreInfo from USER, USER_EXT where user.pk = user_ext.pk
Run Code Online (Sandbox Code Playgroud)
我已经尝试了所有的东西,从使用@Secondarytable到@OneToOne协会,但我不能让它工作.
我现在得到的最好结果是@OneToOne关联生成多个SQL查询,一个用于获取USER中的行,而结果集中的每一行都有一个来自USER_EXT的select查询.
这是非常无效的.
任何的想法 ?
标题非常简单.
我想知道是否有可能直接将编译好的jsp(生成的servlet)看到eclipse中.无需部署到任何服务器上.
hibernate ×2
one-to-one ×2
eclipse ×1
hql ×1
java ×1
jsp ×1
logback ×1
maven ×1
orm ×1
packaging ×1
parameters ×1
performance ×1
precompile ×1
servlets ×1
slf4j ×1
tomcat ×1
xalan ×1
xml ×1
xpath ×1
xslt ×1