IBM Websphere JPA配置-如何更新persistence.xml [英] IBM Websphere JPA configuration - how to update persistence.xml

查看:114
本文介绍了IBM Websphere JPA配置-如何更新persistence.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是EJB 3和JPA的新手.

I'm new to EJB 3 and the JPA.

我已经在appserver中创建了一个数据源,该数据源是jdbc/AppDataSource.默认的持久性提供程序保留为com.ibm.websphere.persistence.PersistenceProviderImpl. 我将默认的jta数据源JNDI名称保留为AppDataSource本身. 我实际上对JTA和非JTA感到困惑.他们有什么区别?

I've created a datasource in the appserver which is jdbc/AppDataSource. The default persistence provider is left as com.ibm.websphere.persistence.PersistenceProviderImpl. And I left the default jta data source JNDI name as AppDataSource itself. I'm actually confused regarding JTA and non-JTA. What differentiates them?

我生成了实体,并在bean中创建了一个EntityTransaction对象. 调用persist()commit()方法时,出现错误:

I generated the entities and created an EntityTransaction object in the bean. Upon calling the persist() and commit() methods, I get an error:

javax.ejb.EJBException: See nested exception; nested exception is: <openjpa-1.2.1-SNAPSHOT-r422266:686069 fatal user error> org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.
Caused by: <openjpa-1.2.1-SNAPSHOT-r422266:686069 fatal user error> org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.

openjpa在这里如何出现?

How does openjpa comes into picture here?

到目前为止,我的persistence.xml仅包含实体类名称.

As of now, my persistence.xml contains the entity class names only.

如何使它使用默认的appserver值作为数据源.否则,如何在persistence.xml中提供jpa provider的详细信息和数据源的详细信息?

How can I make it use the default appserver values for data source. Or else how can I provide the details of jpa provider and datasource details in the persistence.xml?

请提供您的输入.

推荐答案

这个问题实际上涉及许多概念,我将不对其进行详细介绍.有关更详尽的详细信息,建议阅读JPA 1.0规范的整个第5章-实体管理器和持久性上下文(以及此答案末尾提到的其他相关部分).我宁愿尝试描述Java EE环境中最常见的情况.

This question actually involves many concepts and I won't cover them all in details. For more exhaustive details, I suggest reading the whole Chapter 5 - Entity Managers and Persistence Contexts of the JPA 1.0 specification (and the other relevant sections mentioned at the end of this answer). I will rather try to describe the most common scenario in a Java EE environment.

在EJB环境中,通常会使用:

Within an EJB environment, one would typically use:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆