Open cdalexndr opened 4 years ago
Trying a workaround to manually add attribute converters using MetadataBuilderContributor
causes startup to fail because of duplicate attribute converter.
After some debugging it seems that Spring uses DefaultPersistenceUnitManager.buildDefaultPersistenceUnitInfo
to scan for @Converter
classes and registers them, so they work at startup.
I guess this plugin doesn't interoperate with Spring so the reload doesn't use the same initialization mechanism as spring at startup.
I have the following attribute converter:
On startup database validation succeeds, but on reload I get invalid type errors, because the attribute converter is not used, it falls back to SerializableType which is VARBINARY sql type instead of expected VARCHAR (string) type:
org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [url] in table [image]; found [text (Types#VARCHAR)], but expecting [varchar (Types#VARBINARY)]
Using Spring Boot 2.3.3
HOTSWAP AGENT: 21:46:49.652 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hibernate.HibernatePlugin' initialized in ClassLoader 'jdk.internal.loader.ClassLoaders$AppClassLoader@2437c6dc'. HOTSWAP AGENT: 21:46:49.653 INFO (org.hotswap.agent.plugin.hibernate.HibernatePlugin) - Hibernate plugin initialized - Hibernate Core version '5.4.20.Final'