hibernate ImprovedNamingStrategy覆盖实体中的表名 [英] hibernate ImprovedNamingStrategy overrides Table name in entity
问题描述
我正在使用org.hibernate.cfg.ImprovedNamingStrategy,但是对于一个表,我明确指定了表名
@ Table(name =EventLog,schema =eventlogs)
但hibernate似乎在寻找事件日志。不应该显式命名覆盖ImprovedNamingStrategy提供的命名
这是org.hibernate.cfg.ImprovedNamingStrategy的行为,将混合大小写名称转换为嵌入的下划线名称。 http://docs.jboss.org/hibernate /core/3.5/api/org/hibernate/cfg/ImprovedNamingStrategy.html 。因此,如果您明确使用名称EventLog,它将转换为event_log。
如果您只想使用 @Table
中明确指定的名称,则应该使用org.hibernate .cfg.DefaultNamingStrategy。默认情况下,在实例化org.hibernate.cfg.Configuration对象时使用它。
I am using org.hibernate.cfg.ImprovedNamingStrategy, But for a table I have specified the table name explicitly
@Table(name="EventLog",schema = "eventlogs")
But hibernate seems to be looking for event_log. Shouldn't explicit naming override the one provided by ImprovedNamingStrategy
It is the behavior of the org.hibernate.cfg.ImprovedNamingStrategy , which will convert the mixed case names to the embedded underscores name . http://docs.jboss.org/hibernate/core/3.5/api/org/hibernate/cfg/ImprovedNamingStrategy.html . So if you explicitly use the name "EventLog" , it will convert to the "event_log" .
If you simply want to use the name explicitly specified in the @Table
, you should use the org.hibernate.cfg.DefaultNamingStrategy . By default it is used when you instantiate your org.hibernate.cfg.Configuration object
这篇关于hibernate ImprovedNamingStrategy覆盖实体中的表名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!