我正在尝试将XML Hibernate / JPA映射添加到Spring Boot项目中。我应该把它放在哪里,我该怎么命名呢?
我尝试将它放在src / main / resources / orm.xml中,但是没有用。
对于记录,我的orm.xml看起来像这样:
<entity-mappings version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm http://xmlns.jcp.org/xml/ns/persistence/orm_2_1.xsd">
<mapped-superclass class="tech.dashman.common.models.PersistedModel"/>
<mapped-superclass class="tech.dashman.common.models.User"/>
<mapped-superclass class="tech.dashman.common.models.Account"/>
</entity-mappings>
然后在我的项目中,我有一个User和一个Account类,它继承这些类并使用Java注释:
@Entity(name = "accounts")
@Data
@EqualsAndHashCode(callSuper = true)
public class Account extends tech.dashman.common.models.Account {
}
@Entity(name = "users")
@Data
@EqualsAndHashCode(callSuper = true)
public class User extends tech.dashman.common.models.User {
}