@Bean(name = "axonEntityManagerFactory")
@Primary
@Lazy
public LocalContainerEntityManagerFactoryBean axonEntityManagerFactory(
DataSource dataSource,
@Qualifier("jpaProperties") Properties jpaProperties,
JpaVendorAdapter jpaVendorAdapter) {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource);
em.setPackagesToScan(
"org.axonframework.eventsourcing.eventstore.jpa",
"org.axonframework.eventhandling.saga.repository.jpa",
"org.axonframework.eventhandling.tokenstore.jpa");
em.setJpaVendorAdapter(jpaVendorAdapter);
em.setJpaProperties(jpaProperties);
em.setMappingResources("/orm.xml");
return em;
}
Please help, as I seem to be unable to read any events, seeing as these objects are stored as LOB objects and I never seem to be able to pull them down. I am going through this trouble as I just want to pull down all events, from my PostgreSQL DB, based on mrid.....
@Bean(name = "axonEntityManagerFactory")
@Primary
public LocalContainerEntityManagerFactoryBean axonEntityManagerFactory(
DataSource dataSource) {
HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
jpaVendorAdapter.setGenerateDdl(true);
jpaVendorAdapter.setShowSql(true);
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource);
em.setPackagesToScan(
"org.axonframework.eventsourcing.eventstore.jpa",
"org.axonframework.eventhandling.saga.repository.jpa",
"org.axonframework.eventhandling.tokenstore.jpa");
em.setJpaVendorAdapter(jpaVendorAdapter);
em.setMappingResources("/orm.xml");
return em;
}
Properties jpaProperties = new Properties();
jpaProperties.put("hibernate.dialect","com.ge.energy.markets.bids.demand.eventsourcing.db.AxonPostgreSQLDialect");
Could anyone please shed some light on how I could get the properties into the Properties object, from my application.properties file?
Since I seem to be the only one talking to myself... :D -- Has anyone been able to replicate this feat for jsonb types in PostgreSQL? The columns generate OK, but I'm struggling with the SQLDialect for jsonb....I tried utilizing this link to help, to utilize this jsonbinary type descriptor, but to no avail: https://vladmihalcea.com/how-to-map-json-objects-using-generic-hibernate-types/
--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import java.sql.Types;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hibernate.type.descriptor.sql.BinaryTypeDescriptor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
public class AxonPostgreSQLDialect extends PostgreSQL94Dialect {
public AxonPostgreSQLDialect() {
super();
System.out.println("---------Registering Axon PostgreSQLDialect---------");
this.registerColumnType(Types.BLOB, "BYTEA");
}
@Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
if (sqlTypeDescriptor.getSqlType() == java.sql.Types.BLOB) {
return BinaryTypeDescriptor.INSTANCE;
}
return super.remapSqlTypeDescriptor(sqlTypeDescriptor);
public class SpecificPostgreSQLDialect extends PostgreSQL94JsonDialect {
private static final String BYTEA = "BYTEA";
public SpecificPostgreSQLDialect() {
super();
this.registerColumnType(BLOB, BYTEA);
}
@Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
return sqlTypeDescriptor.getSqlType() == BLOB
? BinaryTypeDescriptor.INSTANCE
: super.remapSqlTypeDescriptor(sqlTypeDescriptor);
}
}
Allard, were you able to get any more context on this?
--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to axonfr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
----Guido de Caso
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonfr...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<mapped-superclass class="org.axonframework.eventsourcing.eventstore.AbstractEventEntry">
<attributes>
<basic name="payload" optional="false">
<column column-definition="jsonb" length="1000" />
<convert converter="org.tryout.infrastructure.eventsourcing.axon.postgresql.JpaPostgreSqlJsonbBytearrayConverter" />
</basic>
<basic name="metaData" optional="false">
<column column-definition="jsonb" length="1000" />
<convert converter="org.tryout.infrastructure.eventsourcing.axon.postgresql.JpaPostgreSqlJsonbBytearrayConverter" />
</basic>
</attributes>
</mapped-superclass>
@Converter(autoApply = false)
public class JpaPostgreSqlJsonbBytearrayConverter implements AttributeConverter<byte[], Object> {
@Override
public String convertToDatabaseColumn(byte[] bytes) {
return (bytes != null) ? new String(bytes, StandardCharsets.UTF_8) : null;
}
@Override
public byte[] convertToEntityAttribute(Object json) {
return (json != null) ? json.toString().getBytes(StandardCharsets.UTF_8) : null;
}
}
--
--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/axonframework/02796ded-09ae-46de-9a95-5822f24f6933%40googlegroups.com.
org.postgresql.util.PSQLException: Unsupported Types value: 792,791,759
xyz_1 | 2019-11-10 18:09:30.698 DEBUG 1 --- [ scheduling-1] tributeConverterSqlTypeDescriptorAdapter : Converted value on binding : [B@7820b8e0 -> {"traceId":"4a62c7c4-977d-4a0a-b062-5f691ad1c666","correlationId":"4a62c7c4-977d-4a0a-b062-5f691ad1c666"}
xyz_1 | 2019-11-10 18:09:30.698 TRACE 1 --- [ scheduling-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [UNKNOWN(792791759)] - [{"traceId":"4a62c7c4-977d-4a0a-b062-5f691ad1c666","correlationId":"4a62c7c4-977d-4a0a-b062-5f691ad1c666"}]@Suppress("unused")
@Converter(autoApply = false)
class JpaPostgreSqlJsonbBytearrayConverter : AttributeConverter<ByteArray, Any> {
private val mapper = ObjectMapper()
override fun convertToDatabaseColumn(bytes: ByteArray?): String? {
return if (bytes != null) String(bytes, StandardCharsets.UTF_8) else null
}
override fun convertToEntityAttribute(json: Any?): ByteArray? {
return json?.toString()?.toByteArray(StandardCharsets.UTF_8)
}
companion object : KLogging()
}
Hi Dirk,I haven't heard anything from Daniel after my request to introduce an issue on this point.So sorry Dirk, no, there is no issue on the board for this yet.Thus for now, I would suggest to follow the blog post Allard shared on the topic, as that has been the most pragmatical solution for all Axon users up to now.For clarity, I am talking about this blog post.Hope this helps!Cheers,Steven
On Thu, Aug 1, 2019 at 2:42 PM Herr Manns <h3rm...@gmail.com> wrote:
--Hi!Same problem here for us. I liked daniels Idea of having a switch to get a better behaviour for at least new users.
Is there already an issue you can point to?Thanks,Dirk
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonfr...@googlegroups.com.