我正在尝试使用 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>
1 回答

德玛西亚99
TA贡献1770条经验 获得超3个赞
您可以通过代码进行此调整,这是真的。orm.xml
然而,在您的项目中指定一个文件更为直接,该文件对于某些表(domain_event_entry
我假设您的场景中的表)可以调整某些列。在那里,您应该能够将序列生成器调整为您想要的。
添加回答
举报
0/150
提交
取消