Hibernate没有看到带有引号的表 [英] Hibernate doesn't see tables with quotes in name
问题描述
我在db(postgresql)中有一些表,名字是这样的Test
。当我尝试从这个表中创建java类时,hibernate没有发生。我从名称类似于 test
的表中获得类。如何使hibernate能够查看带名称的表?
默认情况下,Hibernate假定数据库表名与类名相同,但您可以通过 @Table
注释覆盖此行为:
@Entity
@Table(name =\Test \)//将使用Test(包括引号)作为表名
public class Test {
I have some tables in db(postgresql) with names like this "Test"
.When i try create java classes from this tables with hibernate its not happening. I get classes from tables with names like this test
. How to make hibernate can see tables with quotes in names?
UPDATE
Maybe i write question not correct. But i cant create java classes and i want to know how to do reverse ingenering with tables which have names in qoutes. I cant delete qoutes from table names and column names couse they have names like Type and Full.
By default, Hibernate assumes the database table name is the same as the class name, but you can override this behaviour via the @Table
annotation:
@Entity
@Table(name="\"Test\"") // Will use "Test" (including the quotes) as the table name
public class Test {
这篇关于Hibernate没有看到带有引号的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!