You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I have a String field annotated with @Length(max=65535) liquibase assigns the column a type of varchar(255) but hibernate assigns it varchar(65535). Likewise, with I use @NotNull liquibase does not apply a "nullable: false" constraint but hibernate does.
Hibernate does apply the bean validation annotation logic to construct correct metadata during EntityManagerFactoryBuilderImpl.build() but somehow that metadata is lost. When the plugin creates metadata through the MetadataSources process the bean validation annotations are not processed.
I believe the process by which metadata is being extracted is unnecessary. You can get the metadata directly from EntityManagerFactoryBuilderImpl without going through the MetadataSources process. The metadata you get from the builder has the annotations processed as expected.
EntityManagerFactory emf = builder.build();
for (Table table : mi.collectTableMappings()) {
System.out.printf("Table '%s'%n", table.getName());
Iterator<?> i = table.getColumnIterator();
while (i.hasNext()) {
Column col = (Column)i.next();
System.out.printf("\tcol:%s %s %d %b%n", col.getName(), col.getSqlType(dialect, null), col.getLength(), col.isNullable());
}
}
Has this technique already been considered? Has anyone else experienced the issue with bean validation constraints? Does it work for everyone else and I doing something wrong?
I am a bit late to the party, but I have the same problem here.
I am using the hibernate:spring:packageNames url format, and @NotNull and @SiZe are not honored.
Unfortunately, I have merged your pull request and tried, but cannot get it to work.
Annotations are still not honored ...
Can you please post your working configuration?
I'm using liquibase-maven-plugin version 3.5.3 and running liquibase:diff with the following reference:
When I have a String field annotated with @Length(max=65535) liquibase assigns the column a type of varchar(255) but hibernate assigns it varchar(65535). Likewise, with I use @NotNull liquibase does not apply a "nullable: false" constraint but hibernate does.
Hibernate does apply the bean validation annotation logic to construct correct metadata during EntityManagerFactoryBuilderImpl.build() but somehow that metadata is lost. When the plugin creates metadata through the MetadataSources process the bean validation annotations are not processed.
I believe the process by which metadata is being extracted is unnecessary. You can get the metadata directly from EntityManagerFactoryBuilderImpl without going through the MetadataSources process. The metadata you get from the builder has the annotations processed as expected.
Has this technique already been considered? Has anyone else experienced the issue with bean validation constraints? Does it work for everyone else and I doing something wrong?
┆Issue is synchronized with this Jira Bug by Unito
The text was updated successfully, but these errors were encountered: