我正在嘗試使用 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
提交
取消