【发布时间】:2009-06-22 22:56:26
【问题描述】:
我使用 Java/Hibernate/MySQL 制作了一个应用程序,但每当我尝试运行它时,它都会抱怨我的一个实体类的表尚未创建。
经过反复试验,我得出的结论是问题出在我映射嵌入式组件的方式上,但我不知道如何解决。
以下是相关的代码:
@Entity
public class Feed {
... //Definition of some properties
@Embedded
@AttributeOverrides( {
@AttributeOverride(name = "type", column = @Column(name = "title-type")),
@AttributeOverride(name = "mode", column = @Column(name = "title-mode")),
@AttributeOverride(name = "value", column = @Column(name = "title-value")) })
public Content getTitle() { ... }
...
}
@Embeddable
public class Content {
... // There are three properties with bean syntax
// without any persistence annotation.
}
有谁知道为什么 Hibernate 无法为 Feed 类创建表?我该如何纠正?
提前谢谢你。
编辑:终于明白了;我在专栏中使用了“-”字符这一事实是罪魁祸首。我用下划线替换了这些,一切都很好。
非常感谢您的帮助。
【问题讨论】:
标签: java hibernate annotations