Hey Steven & Allard,
I may be missing something… Still not able to accomplish Json serialization.
So, I added my own CustomDomainEventEntry mapping to the “domain_event_entry” table and using String instead of byte[] as the parameterized type. Look:
`
@Entity
@Table(name = “domain_event_entry”, indexes = @Index(columnList = “aggregateIdentifier,sequenceNumber”, unique = true))
public class CustomDomainEventEntry extends AbstractSequencedDomainEventEntry {
//…
}
`
Besides that, I also defined a CustomJpaEventStorageEngine that uses my CustomDomainEventEntry by overriding the following methods:
`
public class CustomJpaEventStorageEngine extends JpaEventStorageEngine {
//…
@Override
protected String domainEventEntryEntityName() {
return CustomDomainEventEntry.class.getSimpleName();
}
@Override
protected Object createEventEntity(EventMessage<?> eventMessage, Serializer serializer) {
return new CustomDomainEventEntry(asDomainEventMessage(eventMessage), serializer);
}
}
`
Additionally, I added a configuration class to tell my app to use my custom stuff. Take a look:
`
@Configuration
public class Axon {
@Autowired
EntityManagerProvider entityManagerProvider;
@Bean
public JpaEventStorageEngine jpaEventStorageEngine() {
return new CustomJpaEventStorageEngine(
entityManagerProvider,
NoTransactionManager.INSTANCE
);
}
}
`
As a result, I’m still getting an error:
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: SQL strings added more than once for: domain_event_entry
It seems that both the default configuration using the original entity and my custom entity are being loaded by the Spring Boot app. How could I make it see only my custom stuff?
And BTW, do I really need to add that much extra code and spend that much time debugging my very simple Axon app just to make it serialize payloads as Json? Either I’m really missing a point or this is not something the framework is expecting a user to wish.
Thanks by the support anyways.
-v