我正在尝试使用 JPA Event Store 和 mysql 数据库来实现 Axon 应用程序。Hibernate 会自动生成所有表,到目前为止它工作正常。
我的问题是 - 我可以用 hibernate_sequence mysql 表替换AUTO_INCREMENTMysql 中的列吗?我想为了做到这一点,我需要修改 Axon 的源代码,因为我找不到其他可配置的方式来修改@Id域事件@Entity或其他实体的注释?
更新
好的,我设法通过src\main\resources\META-INF\orm.xml 使用以下代码放置新文件来做到这一点:
<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
version="2.0">
<mapped-superclass class="org.axonframework.eventhandling.AbstractSequencedDomainEventEntry" access="FIELD">
<attributes>
<id name="globalIndex">
<generated-value strategy="IDENTITY"/>
</id>
</attributes>
</mapped-superclass>
<entity class="org.axonframework.modelling.saga.repository.jpa.AssociationValueEntry" access="FIELD">
<attributes>
<id name="id">
<generated-value strategy="IDENTITY"/>
</id>
</attributes>
</entity>
</entity-mappings>
德玛西亚99
相关分类