HSQLDB 2.2跳过某些实体并且不为它们创建表 [英] HSQLDB 2.2 skipping certain entities and not creating tables for them

查看:104
本文介绍了HSQLDB 2.2跳过某些实体并且不为它们创建表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Hibernate 3.5.5 HSQLDB 2.2.9 。我使用JPA语义来定义实体,并有大约10个实体。

由于某些未知原因,HSQLDB似乎没有选择三个实体,因为我在HSQLDB资源管理器中找不到相应的表以及对这些表的任何引用导致SQL异常用户缺少特权或找不到对象:< TableName>



所有这三个实体都是格式与其他格式相同,如下所示:

  @Entity 
@Table(name =< TABLE_NAME>)
public class TableName
{
// private members;

//受保护的ORM默认构造函数

@Id
@Column(name =< PRIMARY_KEY>)
// public getter for Primary重要成员。

@Column(name =< COLUMN_NAME>)
//所有其​​他成员的public getters;

//受保护的setters
}

HSQLDB跳过一些实体的类似问题?

至少,它一直跳过同样的三个实体,我无法弄清楚那些与其他实体不同的地方。所有这些实体都是在Eclipse中使用JPA构面生成的,因此它们之间没有区别。



我的persistence.xml只有这个:

 < persistence-unit name = fssPersistenceUnittransaction-type =RESOURCE_LOCAL> 
< / persistence-unit>

和HSQLDB 2.0用于选择所有使用 @Entity ,而HSQLDB 2.2.9并没有选择全部,而是留下了前面提到的三个实体。

编辑2
启用SQL语句的日志记录后,我看到这三个表的CREATE TABLE语句被回滚。我无法获得有关这些创建表语句错误的更多信息。打印时会截断CREATE TABLE语句。

解决方案

HSQLDB的Hibernate方言在Hibernate 3.6及更高版本中进行了更新。不知道3.5.x是否适用于HSQLDB 2.2.x



在任何情况下,您都可以使用file:database并添加hsqldb.sqllog = 2属性到数据库的URL。这将产生所有执行的SQL语句的日志。您可以检查缺失表格的声明。



参阅指南:

http://hsqldb.org/doc/2.0/guide/dbproperties-chapt.html

I am working with Hibernate 3.5.5 and HSQLDB 2.2.9. I use JPA semantics to define Entities and have around 10 entities.

For some unknown reason, the HSQLDB doesn't seem to be picking three entities as I don't find the corresponding tables in the HSQLDB explorer and any reference to those tables result in SQL exception user lacks privilege or object not found: <TableName>.

All the three entities are in the same format as the other ones and as follows:

@Entity
@Table(name = "<TABLE_NAME>")
public class TableName
{
     // private members;

     // protected default constructor for the ORM

     @Id
     @Column(name = <PRIMARY_KEY>)
     // public getter for Primary Key member.

     @Column(name = <COLUMN_NAME>)
     // public getters for all other members;

     // protected setters
}

Did anyone face a similar issue where HSQLDB is skipping some entities?

At least, it is consistently skipping the same three entities and I am not able to figure out what is different in those from the rest. All these entities are generated using the JPA facet in Eclipse so there is no difference as such among these.

Edit 1:

My persistence.xml simply has this:

<persistence-unit name="fssPersistenceUnit" transaction-type="RESOURCE_LOCAL">
</persistence-unit>

and HSQLDB 2.0 used to pick all the entities annotated with @Entity, whereas HSQLDB 2.2.9 doesn't pick all and leaves three entities as mentioned earlier.

Edit 2: After enabling the logging of SQL statements, I see that the CREATE TABLE statements for these three tables are rolled back. I am not able to get any further information on what was wrong with these create table statements. Also, the CREATE TABLE statement is truncated when printed.

解决方案

The Hibernate dialect for HSQLDB was updated in Hibernate 3.6 and later. It is not known if 3.5.x works well with HSQLDB 2.2.x

In any case, you can use a file: database and add the hsqldb.sqllog=2 property to the database URL. This will produce a log of all the executed SQL statements. You can then check for the statements for the missing tables.

See the Guide:

http://hsqldb.org/doc/2.0/guide/dbproperties-chapt.html

这篇关于HSQLDB 2.2跳过某些实体并且不为它们创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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