0

我在 Netbeans 中创建了这个项目,这是我知道访问其中任何一个的唯一方法。我似乎无法找到存储我的对象的数据库,以便我可以删除它们。事实上,我最好在每次重新启动 glassfish 时简单地删除所有内容。我了解更改课程会导致此类问题,但我不知道如何删除有关旧版本课程的信息。到目前为止,我一直试图通过在每次更改类名时重构类名来解决这个问题,但我已经用完了有创意的名称。

例外:

javax.servlet.ServletException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Column 'CURRENTDAY' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then 'CURRENTDAY' is not a column in the target table.
Error Code: -1
Call: SELECT ID, CURRENTDAY, INTERNAL_TIME_M, LASTTIME_M FROM FASTINTERNALCLOCK WHERE (ID = ?)
    bind => [1 parameter bound]
Query: ReadObjectQuery(name="readObject" referenceClass=FastInternalClock sql="SELECT ID, CURRENTDAY, INTERNAL_TIME_M, LASTTIME_M FROM FASTINTERNALCLOCK WHERE (ID = ?)")

我所做的是 FASTINTERNALCLOCK 类的新 CURRENTDAY 成员不在它正在寻找的表中,可能是因为它正在基于该成员尚未存在的旧版本的类的表中查找。我怎样才能删除这个表,以便可以在考虑新成员的情况下重新创建它?

持久性.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  <persistence-unit name="webThermosPU" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/__default</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="eclipselink.ddl-generation" value="create-tables"/>
    </properties>
  </persistence-unit>
</persistence>
4

2 回答 2

0

您的 SQL 安装应该附带一个 WorkBench 程序,您可以使用它来访问您的数据库,并在需要时从中删除表和/或行。

于 2013-03-10T21:46:28.013 回答
0

尝试使用值“drop-and-create-tables”来删除 DDL 并在部署时创建表。Glashfish 在嵌入式 derby 数据库上设置默认 __datasource,如下所述http://docs.oracle.com/cd/E18930_01/html/821-2424/gksmw.html

于 2013-03-11T11:41:06.630 回答