想象一下,Event实体引用状态实体:
@Entity
@Table(name = "event")
public class Event()
{
@Id
@Column(name = "id", nullable = false)
private long id;
...
@ManyToOne
@JoinColumn(name = "status_code", nullable = false)
private Status status;
}
@Entity
@Table(name = "status")
public class Status()
{
@Id
@Column(name = "code", nullable = false)
private String code;
@Column(name = "label", nullable = false, updatable = false)
private String label;
}
Run Code Online (Sandbox Code Playgroud)
状态映射到一个小表' status'. 状态是典型的参考数据/查找实体.
code label
----- --------------
CRD Created
ITD Initiated …Run Code Online (Sandbox Code Playgroud) 上下文: JBoss Application Server 6
我依靠slf4j-jboss-logmanager.jar将slf4j绑定到JBoss日志管理器.
正确记录所有logger.info()输出.
但是,logger.debug()输出永远不会出现在日志流中.
即使jboss-logging.xml已将级别设置DEBUG为CONSOLE记录器......
<console-handler name="CONSOLE" autoflush="true" target="System.out">
...
<level name="DEBUG"/>
...
</console-handler>
Run Code Online (Sandbox Code Playgroud)
有人知道为什么我的调试细节永远不会到达日志流吗?
"删除所有附件"权限被授予"jira-users"组.我是"jira-users"的成员.虽然,我没有看到删除附件的方法(实际截图).
想象一下表emp:
CREATE TABLE emp
( id NUMBER
, name VARCHAR
, dept_code VARCHAR
)
Run Code Online (Sandbox Code Playgroud)
和一个表部门:
CREATE TABLE dept
( code VARCHAR
, name VARCHAR
)
Run Code Online (Sandbox Code Playgroud)
emp.dept_code引用dept.code为ForeignKey.
这些表映射到JPA实体,ForeignKey被建模为关联:
@ManyToOne
@JoinColumn(name = "dept_code")
private Department department;
Run Code Online (Sandbox Code Playgroud)
鉴于以下数据:
emp dept
---------------- ------------------
1 John SALS SALS Sales
2 Louis SALS SUPT Support
3 Jack SUPT
4 Lucy SUPT
Run Code Online (Sandbox Code Playgroud)
我想编写一个JPA查询,返回支持部门中的所有Emloyees.假设我知道支持部门的PrimaryKey(SUPT)
我猜那会是:
SELECT emp
FROM Employee emp JOIN emp.department dept
WHERE dept.code = 'SUPT' …Run Code Online (Sandbox Code Playgroud) 考虑一个页面webapp/myPage.xhtml:
...
<h:form id="myForm">
...
<h:selectOneMenu id="..." required="true" value="#{myController.aValue}">
<f:selectItems value="#{...}" var="..." itemValue="#{...}" itemLabel="#{...}"/>
</h:selectOneMenu>
...
<h:commandButton value="Go for it!" action="#{myController.goForIt(...)}"/>
...
</h:form>
...
Run Code Online (Sandbox Code Playgroud)
按钮操作绑定到控制器方法MyController.goForIt():
@ManagedBean(name = "myController")
@RequestScoped
public class MyController {
public String goForIt(...){
if (myCondition){
try {
FacesContext.getCurrentInstance().getExternalContext()
.redirect("http://www.myTarget.com/thePage.html");
} catch (IOException e) {
...
}
}
return "myPage.xhtml"
}
}
Run Code Online (Sandbox Code Playgroud)
我的第一个问题是:上述内容是否有意义?这是使用redirect()的正确方法吗?
我想重定向用户http://www.myTarget.com/thePage.html,以防万一myCondition.如果myCondition是假的,他将不得不留下来myPage.xhtml.
如果是这样,我想更好地了解会发生什么...... 在Firefox中使用Live HTTP Headers时,我会发现单击按钮时
考虑 3 个 Jpeg 文件
对于给定的 URL 和一组参数,我希望服务器选择并返回其中一个图像。
我在 JEE6 环境中工作。您会推荐什么方法?
欢迎任何建议!
在纯 JSF2.0应用程序中访问Manifest属性(从/META-INF/Manifest.mf)的最佳方法是什么?
想象一个绑定到ManagedBean的文本框:
<h:inputText id="name" value="#{mb.name}"/>
Run Code Online (Sandbox Code Playgroud)
我想将字段默认为值.
我知道我可以在构造时在ManagedBean中设置值,但这对我不起作用,因为我在不同的xhtml页面中使用相同的ManagedBean作为辅助bean.而且我不希望在所有这些页面中初始化'name'字段.
有人可以建议一个策略吗?还是我错过了必不可少的东西?
非常感谢你!J.
使用Hibernate EntityManager 3.5.3-Final和Unitils 3.1会导致:
unitilsAfterTestTearDown(com.unifiedpost.payments.model.TestAccount) Time elapsed: 0.02 sec <<< FAILURE!
java.lang.AbstractMethodError: org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:621)
at org.unitils.orm.jpa.util.provider.hibernate.UnitilsHibernatePersistenceProvider.createContainerEntityManagerFactory(UnitilsHibernatePersistenceProvider.java:47)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:227)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:281)
at org.unitils.orm.jpa.util.JpaEntityManagerFactoryLoader.createEntityManagerFactoryBean(JpaEntityManagerFactoryLoader.java:77)
Run Code Online (Sandbox Code Playgroud)
这也在以下网站报道:http: //jira.unitils.org/browse/UNI-201