我有一个班级Customer和CustomerDependant实体.Customer与其家属有多对多的双向关系.我需要找到按名称和从属名称过滤的客户.
它在JPQL中做了类似的事情:
select c join fetch c.dependants d from Customer c where c.name like
'foo' and d.name like 'foo'
Run Code Online (Sandbox Code Playgroud)
我如何使用JPA Criteria Queries做同样的事情?
默认情况下,ValidationMessages.properties可以位于我的类路径的根目录中.我可以像com.myapp.Anything.properties一样更改此文件的位置吗?
我有一个安静的Web服务,响应是:
{
"cities": [{
"id": "1",
"name": "City 01",
"state": "A1"
}, {
"id": "2",
"name": "City 02",
"state": "A1"
}]
}
Run Code Online (Sandbox Code Playgroud)
但我想要这个:
{
[{
"id": "1",
"name": "City 01",
"state": "A1"
}, {
"id": "2",
"name": "City 02",
"state": "A1"
}]
}
Run Code Online (Sandbox Code Playgroud)
我如何配置JAX-RS只使用JAX-RS功能而不是根节点生成JSON,而不是实现特定功能?我的代码需要可以在任何appserver上移植.
在CDI 1.2中,有一种方法可以检查类实例是否被代理?我需要这个,因为我需要获取原始类的名称,而不是代理名称.
@Inject Bean bean;
public void sysout() {
// will print something like com.Bean$$Weld9239823
System.out.println(bean.getClass());
// I don't know how to check if the bean instance if a proxy or real class instance
}
Run Code Online (Sandbox Code Playgroud)
使用Weld类我可以完成这项工作:
public void sysout() {
// will print true because this is a proxy
System.out.println(ProxyObject.class.isAssignableFrom(bean));
// will print com.Bean
System.out.println(((TargetInstanceProxy) bean).getTargetInstance());
}
Run Code Online (Sandbox Code Playgroud)
在CDI 1.1中,没有方法可以做到这一点.我在CDI 1.2文档中搜索如果添加了一个方法,但我没有找到任何东西.
所以...我想念一些东西和CDI 1.2有一种获取原始类名和实例的方法吗?或者,如果没有,有一个平原在附近功能添加此功能?
我有一个使用组合的应用程序(用于页面模板).但我们认为创建一个Web应用程序(战争)来托管所有应用程序在同一主机中共享的所有模板.
如何从其他上下文中包含模板?这时我使用从http请求导入.但这听起来很糟糕.
<ui:composition template="http://localhost:8080/templates/layout/foo.xhtml">
我正在使用JBoss Seam 2.x和JSF 1.