注入EntityManager时出现以下错误:
Caused by: org.hibernate.exception.SQLGrammarException: could not prepare statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert (SQLStateConversionDelegate.java:123) [hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert (StandardSQLExceptionConverter.java:49) [hibernate-core-4.3.5.Final.jar:4.3.5.Final] Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT SUBJECT_SEQ.NEXTVAL FROM[*] DUAL "; expected "identifier"; SQL statement: select SUBJECT_SEQ.nextval from dual [42001-173] at org.h2.message.DbException.getJdbcSQLException(DbException.java:331) at org.h2.message.DbException.get(DbException.java:171) at org.h2.message.DbException.getSyntaxError(DbException.java:196) at org.h2.command.Parser.readColumnIdentifier(Parser.java:2846) at org.h2.command.Parser.readTermObjectDot(Parser.java:2401)
persistence.cfg片段:
<class>gov.dhs.obim.domain.bm.Vendor</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:bm/password@localhost:1521:XE"/>
<property name="hibernate.connection.password" value="password"/>
<property name="hibernate.connection.username" value="obim"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
</properties>
</persistence-unit>
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@Stateless
@WebService(targetNamespace = "http://docs.oasis-
open.org/org.oasis.bias/ns/org.oasis.bias-1.0/", name = "BIAS_v1")
public class BIASV1Impl implements BIASV1 {
@PersistenceContext(unitName = "OBIM_BIAS2")
EntityManager em;
@Override
public EnrollResponsePackage enroll(EnrollRequest enrollRequest)
throws BIASFaultMessage {
Subject subject = new Subject();
Encounter encounter = new Encounter();
subject.addEncounter(encounter);
assert(subject.getEncounters().contains(encounter));
assert(encounter.getSubject() == subject);
em.persist(subject);
em.persist(encounter);
return null;
}
任何想法为什么注入EntityManager导致解析器重新验证SQL语句
SELECT SUBJECT_SEQ.NEXTVAL FROM[*] DUAL
?
这导致了导致错误
org.hibernate.exception.SQLGrammarException: could not prepare statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert (SQLStateConversionDelegate.java:123) [hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert (StandardSQLExceptionConverter.java:49) [hibernate-core-4.3.5.Final.jar:4.3.5.Final]