javax.ejb.EJBException: 使用实体管理器向Derby数据库表插入记录时事务中止

huangapple go评论82阅读模式
英文:

javax.ejb.EJBException: Transaction aborted while inserting record to Derby db table using Entity Manager

问题

这里是错误日志和相关代码的翻译:

错误日志:

javax.faces.el.EvaluationException: javax.ejb.EJBException: 事务已中止
...

Caused by: javax.transaction.RollbackException: 标记为回滚的事务。
...

Caused by: javax.persistence.PersistenceException: 异常 [EclipseLink-4002](Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd):org.eclipse.persistence.exceptions.DatabaseException
内部异常:java.sql.SQLSyntaxErrorException:语法错误:在第1行第13列遇到 "Order"。
错误代码:20000
查询:INSERT INTO Order(ID,Quantity,TIMECREATED,UNITPRICE,CARID,CUSTOMERID)VALUES(?,?,?,?,?,?)
...

实体类:

@Entity
@Table(name = "CUSTOMER")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AllCustomer", query = "SELECT c FROM Customer c")
    , @NamedQuery(name = "findCustomerByName", query = "SELECT c FROM Customer c WHERE c.name = :name")
    , @NamedQuery(name="findCustomerById",query= "SELECT c FROM Customer c WHERE c.id = :id")})
public class Customer implements Serializable {
    ...
    @OneToMany
    private List<Order> carorders;
    ...
}

@Entity
@Table(name = "BRANDNEWCAR")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AllNewCars", query = "SELECT b FROM NewCar b")
    , @NamedQuery(name = "findNewCarByReferencenumber", query = "SELECT b FROM NewCar b WHERE b.referencenumber = :referencenumber")
    , @NamedQuery(name="findNewCarById",query= "SELECT c FROM NewCar c WHERE c.id = :id")})
public class NewCar implements Serializable {
    ...
    @OneToMany
    private List<Order> carorders;
    ...
}

@Entity
@Table(name = "Order")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AllOrders", query = "SELECT c FROM Order c")
    , @NamedQuery(name = "findOrderById", query = "SELECT c FROM Order c WHERE c.id = :id")
    , @NamedQuery(name = "DeleteOrder", query = "DELETE FROM Order c WHERE c.id = :id")})
public class Order implements Serializable {
    ...
    @ManyToOne(cascade={
        CascadeType.DETACH, CascadeType.MERGE, CascadeType.REFRESH})
    @JoinColumn(name="CUSTOMERID", referencedColumnName = "ID")
    private Customer customer;
    
    @ManyToOne
    @JoinColumn(name="CARID", referencedColumnName = "ID")
    private NewCar car;
    ...
}

Java Managed Bean 代码:

order.setCustomer(selectedcustomer);
order.setCar(selectedcar);
order.unitPrice = selectedcar.getPrice();
order = orderEJB.CreateNewOrder(order);

persistence.xml 配置:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  <persistence-unit name="CarSalesEnterpriseApplicationPU" transaction-type="JTA">
    <jta-data-source>jdbc/carsalesenterpriseapp</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
    </properties>
  </persistence-unit>
</persistence>

希望这些翻译对您有帮助。如果您需要进一步的帮助,请随时提问。

英文:

hi i'm working on Java EE 7 web application everything works perfect but when i try to create Order which have Many-to-one relationship with two entities i.e. Car and Customer i have tried all other answers that are posted around. please take a look at the code below

Here is the Error Log

javax.faces.el.EvaluationException: javax.ejb.EJBException: Transaction aborted
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.ejb.EJBException: Transaction aborted
at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:725)
at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:503)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2074)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2044)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:220)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy380.CreateNewOrder(Unknown Source)
at EJBModule.__EJB31_Generated__OrderEJB__Intf____Bean__.CreateNewOrder(Unknown Source)
at EJBModule.OrderController.doCreateOrder(OrderController.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.el.parser.AstValue.invoke(AstValue.java:289)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
... 36 more
Caused by: javax.transaction.RollbackException: Transaction marked for rollback.
at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:490)
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:854)
at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:719)
... 55 more
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Syntax error: Encountered &quot;Order&quot; at line 1, column 13.
Error Code: 20000
Call: INSERT INTO Order (ID, Quantity, TIMECREATED, UNITPRICE, CARID, CUSTOMERID) VALUES (?, ?, ?, ?, ?, ?)
bind =&gt; [6 parameters bound]
Query: InsertObjectQuery(EJBModule.Order[ id=3 ])
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl$1.handleException(EntityManagerSetupImpl.java:696)
at org.eclipse.persistence.transaction.AbstractSynchronizationListener.handleException(AbstractSynchronizationListener.java:275)
at org.eclipse.persistence.transaction.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:170)
at org.eclipse.persistence.transaction.JTASynchronizationListener.beforeCompletion(JTASynchronizationListener.java:68)
at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:452)
... 57 more
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Syntax error: Encountered &quot;Order&quot; at line 1, column 13.
Error Code: 20000
Call: INSERT INTO Order (ID, Quantity, TIMECREATED, UNITPRICE, CARID, CUSTOMERID) VALUES (?, ?, ?, ?, ?, ?)
bind =&gt; [6 parameters bound]
Query: InsertObjectQuery(EJBModule.Order[ id=3 ])
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:682)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:558)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2002)
at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:298)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:377)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:165)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:180)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:489)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:301)
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:798)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1737)
at org.eclipse.persistence.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:226)
at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:125)
at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:4207)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1441)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1531)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.issueSQLbeforeCompletion(UnitOfWorkImpl.java:3168)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.issueSQLbeforeCompletion(RepeatableWriteUnitOfWork.java:352)
at org.eclipse.persistence.transaction.AbstractSynchronizationListener.beforeCompletion(AbstractSynchronizationListener.java:158)
... 59 more
Caused by: java.sql.SQLSyntaxErrorException: Syntax error: Encountered &quot;Order&quot; at line 1, column 13.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.Connection.prepareStatement(Unknown Source)
at com.sun.gjc.spi.base.ConnectionHolder.prepareStatement(ConnectionHolder.java:586)
at com.sun.gjc.spi.jdbc40.ConnectionWrapper40.prepareCachedStatement(ConnectionWrapper40.java:255)
at com.sun.gjc.spi.jdbc40.ConnectionWrapper40.prepareCachedStatement(ConnectionWrapper40.java:52)
at com.sun.gjc.spi.ManagedConnectionImpl.prepareCachedStatement(ManagedConnectionImpl.java:992)
at com.sun.gjc.spi.jdbc40.ConnectionWrapper40.prepareStatement(ConnectionWrapper40.java:173)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.prepareStatement(DatabaseAccessor.java:1556)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.prepareStatement(DatabaseAccessor.java:1505)
at org.eclipse.persistence.internal.databaseaccess.DatabaseCall.prepareStatement(DatabaseCall.java:778)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:619)
... 88 more
Caused by: org.apache.derby.client.am.SqlException: Syntax error: Encountered &quot;Order&quot; at line 1, column 13.
at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
at org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutput(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutput(Unknown Source)
at org.apache.derby.client.am.PreparedStatement.prepare(Unknown Source)
at org.apache.derby.client.am.Connection.prepareStatementX(Unknown Source)
... 98 more

Here are the Entity Classes

@Entity
@Table(name = &quot;CUSTOMER&quot;)
@XmlRootElement
@NamedQueries({
@NamedQuery(name = &quot;AllCustomer&quot;, query = &quot;SELECT c FROM Customer c&quot;) 
, @NamedQuery(name = &quot;findCustomerByName&quot;, query = &quot;SELECT c FROM Customer c WHERE c.name = :name&quot;)
, @NamedQuery(name=&quot;findCustomerById&quot;,query= &quot;SELECT c FROM Customer c WHERE c.id = :id&quot;)})
public class Customer implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Size(max = 30)
@Column(name = &quot;NAME&quot;)
private String name; 
@Size(max = 30)
@Column(name = &quot;EMAIL&quot;)
private String email;
@Size(max = 30)
@Column(name = &quot;PHONE&quot;)
private String phone;
@Size(max = 30)
@Column(name = &quot;ADDRESS&quot;)
private String address;
@OneToMany
private List&lt;Order&gt; carorders;
@Entity
@Table(name = &quot;BRANDNEWCAR&quot;)
@XmlRootElement
@NamedQueries({
@NamedQuery(name = &quot;AllNewCars&quot;, query = &quot;SELECT b FROM NewCar b&quot;)
, @NamedQuery(name = &quot;findNewCarByReferencenumber&quot;, query = &quot;SELECT b FROM NewCar b WHERE b.referencenumber = :referencenumber&quot;)
, @NamedQuery(name=&quot;findNewCarById&quot;,query= &quot;SELECT c FROM NewCar c WHERE c.id = :id&quot;)})
public class NewCar implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Size(max = 30)
@Column(name = &quot;REFERENCENUMBER&quot;)
private String referencenumber;
@Column(name = &quot;MAKE&quot;)
private String make;
@Size(max = 30)
@Column(name = &quot;MODEL&quot;)
private String model;
@Size(max = 30)
@Column(name = &quot;DRIVETYPE&quot;)
private String drivetype;
@Size(max = 30)
@Column(name = &quot;BODYCOLOUR&quot;)
private String bodycolour;
@Size(max = 30)
@Column(name = &quot;TRANSMISSION&quot;)
private String transmission;
@Size(max = 30)
@Column(name = &quot;ENGINE&quot;)
private String engine;
@Size(max = 30)
@Column(name = &quot;FUELTYPE&quot;)
private String fueltype;
@Column(name = &quot;DOORS&quot;)
private Integer doors;
@Column(name = &quot;SEATS&quot;)
private Integer seats;
@Column(name = &quot;PRICE&quot;)
private Float price;
@Column(name = &quot;WARRANTY&quot;)
private Integer warranty;
@Column(name = &quot;EXTENDEDWARRANTY&quot;)
private Integer extendedwarranty;
@Size(max = 30)
@Column(name = &quot;ASSISTANCE&quot;)
private String assistance;
@Column(name = &quot;StockQty&quot;)
private Integer stockqty;
@OneToMany
private List&lt;Order&gt; carorders;
@Entity
@Table(name = &quot;Order&quot;)
@XmlRootElement
@NamedQueries({
@NamedQuery(name = &quot;AllOrders&quot;, query = &quot;SELECT c FROM Order c&quot;)
, @NamedQuery(name = &quot;findOrderById&quot;, query = &quot;SELECT c FROM Order c WHERE c.id = :id&quot;)
, @NamedQuery(name = &quot;DeleteOrder&quot;, query = &quot;DELETE FROM Order c WHERE c.id = :id&quot;)})
public class Order implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(nullable = false)
protected Float unitPrice; 
@Column(nullable = false)
@Temporal(TemporalType.TIMESTAMP)
protected Date timeCreated = new Date();
@Column(name = &quot;Quantity&quot;)
private Integer Qty;
@ManyToOne(cascade={
CascadeType.DETACH, CascadeType.MERGE, CascadeType.REFRESH})
@JoinColumn(name=&quot;CUSTOMERID&quot;, referencedColumnName = &quot;ID&quot;)
private Customer customer;
@ManyToOne
@JoinColumn(name=&quot;CARID&quot;, referencedColumnName = &quot;ID&quot;)
private NewCar car;

Here is the code which used in Java Managed Bean to create record

        order.setCustomer(selectedcustomer);
order.setCar(selectedcar);
order.unitPrice = selectedcar.getPrice();
order = orderEJB.CreateNewOrder(order);

here are the details of Persistance.xml

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;persistence version=&quot;2.1&quot; xmlns=&quot;http://xmlns.jcp.org/xml/ns/persistence&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd&quot;&gt;
&lt;persistence-unit name=&quot;CarSalesEnterpriseApplicationPU&quot; transaction-type=&quot;JTA&quot;&gt;
&lt;jta-data-source&gt;jdbc/carsalesenterpriseapp&lt;/jta-data-source&gt;
&lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt;
&lt;properties&gt;
&lt;property name=&quot;javax.persistence.schema-generation.database.action&quot; value=&quot;drop-and-create&quot;/&gt;
&lt;/properties&gt;
&lt;/persistence-unit&gt;
&lt;/persistence&gt;

I don't know why it doesn't work, thanks in advance.

答案1

得分: 3

这是Derby SQL中的保留字列表:http://db.apache.org/derby/docs/10.15/ref/rrefkeywords29722.html

ORDER是其中的一个保留字。

您能否将您的应用程序更改为使用其他单词而不是ORDER

英文:

Here's the list of reserved words in Derby's SQL: http://db.apache.org/derby/docs/10.15/ref/rrefkeywords29722.html

ORDER is one of those reserved words.

Can you change your application to use a different word instead of ORDER?

huangapple
  • 本文由 发表于 2020年10月7日 23:49:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/64247719.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定