gpt4 book ai didi

jboss - JBoss AS 7.1.1 的 Persistence.xml

转载 作者:行者123 更新时间:2023-12-01 00:01:27 26 4
gpt4 key购买 nike

我有一个与 JBoss AS 7.1.1 一起运行的客户端和服务器设置,我对我的 persistence.xml 有疑问。目前它看起来像这样:

<persistence>
<persistence-unit name="GrahamsProj">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/WorkCenterDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
</properties>
</persistence-unit>
</persistence>

我在服务器的 META-INF 文件夹中有 persistence.xml。我一定是缺少一些属性,因为当我尝试查询连接到的数据库时遇到此错误。

11:35:07,840 ERROR [org.jboss.ejb3.invocation] (EJB default - 1) JBAS014134: 
EJB Invocation failed on component GrahamsProjBean for method public abstract
void grahamsprojserver.session.interfaces.GrahamsProjBeanRemote.test(): javax.ejb.EJB
Exception: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException:
Schemas is not mapped [FROM Schemas s]

有什么我想念的吗?

最佳答案

您需要在 persistence.xml 中包含所有模型类。示例:

<persistence>
<persistence-unit name="GrahamsProj">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/WorkCenterDS</jta-data-source>
<class>your.class.model.Example</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
</properties>
</persistence-unit>
</persistence>

关于jboss - JBoss AS 7.1.1 的 Persistence.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12011174/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com