Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Exception in thread "main" org.hibernate.service.spi.ServiceException

Olá pessoal, quando vou criar a tabela acontece esse erro:

ERROR: The server time zone value 'E. South America Standard Tim' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support. Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152) at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.(InFlightMetadataCollectorImpl.java:175) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:118) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1202) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1233) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54) at br.com.alura.jpa.test.TesteCriaTabelas.main(TesteCriaTabelas.java:8)

2 respostas
solução!

Olá Raphael, tudo bem com você?

Isso normalmente acontece com o banco de dados não conseguir pegar o timezone, para corrigir basta adicionar nas configurações, da seguinte maneira:

<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/alura_jpa?useTimezone=true&amp;serverTimezone=UTC"/>

No caso a parte essencial é após o nome do banco de dados adicionar:

?useTimezone=true&amp;serverTimezone=UTC"

Dessa forma nos conectamos com o timezone ideal :)

Abraços e Bons Estudos!

Pessoal, já resolvi o problema, era na configuração do time zone... Basta acrescentar o parâmetro serverTimezone=UTC ao persistence. Fica assim:

<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/alura_jpa?serverTimezone=UTC" >

Até +