GUJ Discussões   :   últimos tópicos   |   categorias   |   GUJ Respostas

Hibernate não mapeia entidades

Olá pessoal, alguém pode me socorrer? Já faz uma semana que estou tentando resolver este problema. O Hibernate não consegue mapear minha Entidade.

nov 24, 2021 12:05:49 PM org.hibernate.Version logVersion

INFO: HHH000412: Hibernate Core {5.3.20.Final}

nov 24, 2021 12:05:49 PM org.hibernate.cfg.Environment

INFO: HHH000206: hibernate.properties not found

nov 24, 2021 12:05:50 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager

INFO: HCANN000001: Hibernate Commons Annotations {5.0.4.Final}

nov 24, 2021 12:05:50 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)

nov 24, 2021 12:05:50 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001005: using driver [org.postgresql.Driver] at URL [jdbc:postgresql://127.0.0.1:5000/busca]

nov 24, 2021 12:05:50 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001001: Connection properties: {user=postgres, password=****}

nov 24, 2021 12:05:50 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001003: Autocommit mode: false

nov 24, 2021 12:05:50 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections

INFO: HHH000115: Hibernate connection pool size: 1 (min=1)

nov 24, 2021 12:05:50 PM org.hibernate.dialect.Dialect

INFO: HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect

nov 24, 2021 12:05:50 PM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation

INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException

nov 24, 2021 12:05:50 PM org.hibernate.type.BasicTypeRegistry register

INFO: HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@71e9ebae

nov 24, 2021 12:05:50 PM org.hibernate.resource.transaction.internal.TransactionCoordinatorBuilderInitiator determineStrategySelection

WARN: HHH90000018: Found use of deprecated transaction factory setting [hibernate.transaction.factory_class]; use the new TransactionCoordinatorBuilder settings [hibernate.transaction.coordinator_class] instead

nov 24, 2021 12:05:51 PM org.hibernate.resource.beans.spi.ManagedBeanRegistryInitiator resoveBeanContainer

INFO: HHH10005002: No explicit CDI BeanManager reference was passed to Hibernate, but CDI is available on the Hibernate ClassLoader.

nov 24, 2021 12:05:51 PM org.hibernate.validator.internal.util.Version

INFO: HV000001: Hibernate Validator 6.1.5.Final

nov 24, 2021 12:05:51 PM org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateService

INFO: HHH000397: Using ASTQueryTranslatorFactory

Exception in thread “main” java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: usuario is not mapped [from usuario]

at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:138)

at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)

at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)

at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:729)

at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:104)

at Client.main(Client.java:17)

Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: usuario is not mapped [from usuario]

at org.hibernate.hql.internal.ast.QuerySyntaxException.generateQueryException(QuerySyntaxException.java:79)

at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:103)

at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:219)

at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:143)

at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:119)

at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:80)

at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:153)

at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:611)

at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:720)

… 2 more

Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: usuario is not mapped

at org.hibernate.hql.internal.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:169)

at org.hibernate.hql.internal.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:91)

at org.hibernate.hql.internal.ast.tree.FromClause.addFromElement(FromClause.java:79)

at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:331)

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3695)

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3584)

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:720)

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:576)

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:313)

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:261)

at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:271)

at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:191)

… 8 more

Você está usando o método createQuery e ele usa JPQL, logo ele não deve estar encontrando sua entidade porquê o nome dela é Usuario com letra maiúscula, e não usuario igual escreveu na sua query.

Veja que o erro reclamado é de sintaxe!

//