P
P
P_Alexander2018-06-26 15:56:36
Java
P_Alexander, 2018-06-26 15:56:36

Why doesn't hibernate update the table?

Good afternoon!
I am getting this error

[org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-2) ERROR: value too long for type character varying(30)

And I understand why
@NotNull
    @Size(min = 8, max = 30)
    @Column(name = "password", unique = false, length = 30, nullable = false)
    private String password;

now when I change to a larger number in the code, the length of the string does not increase in the database (checked)! In the hibernate settings, I indicated to update the table, but for some reason it does not ipdate it.
hibernate.hbm2ddl.auto=update
The project has been rebuilt.
Can anyone tell me where I went wrong?
Full stacktrace, or rather part.
[org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-2) SQL Error: 0, SQLState: 22001
15:38:59,755 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-2) ERROR: value too long for type character varying(30)
15:38:59,757 INFO  [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (default task-2) HHH000010: On release of batch it still contained JDBC statements
15:38:59,758 ERROR [org.hibernate.internal.ExceptionMapperStandardImpl] (default task-2) HHH000346: Error during managed flush [org.hibernate.exception.DataException: could not execute statement]
15:38:59,764 ERROR [io.undertow.request] (default task-2) UT005023: Exception handling request to /MakeYourDream/registration: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:986)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:881)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
  at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124)
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Smirnov, 2018-06-26
@P_Alexander

A Google search for the phrase " hibernate.hbm2ddl.auto update not working " yields the following information about how " update " works:
To fully work with the database structure, use migration systems, such as Liquibase or FlywayDb. The functions built into Hibernate are of little use for real projects, they are suitable mainly for tests.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question