Skip to content

Spring no longer recognizes mapped classes [SPR-10826] #15452

@spring-projects-issues

Description

@spring-projects-issues

David J. M. Karlsen opened SPR-10826 and commented

I've upgraded from spring 3.2.4 (where things work OK) to 4.0.0.M2, and spring no longer recognizes my JPA mapped classes.

2013-08-12 13:45:41,344 [main][][][][][][][] DEBUG org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
2013-08-12 13:45:41,346 [main][][][][][][][] DEBUG org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
2013-08-12 13:45:41,372 [main][][][][][][][] DEBUG org.hibernate.validator.internal.xml.ValidationXmlParser - Trying to load META-INF/validation.xml for XML based Validator configuration.
2013-08-12 13:45:41,378 [main][][][][][][][] DEBUG org.hibernate.validator.internal.xml.ValidationXmlParser - No META-INF/validation.xml found. Using annotation based configuration only.
2013-08-12 13:45:41,415 [main][][][][][][][] DEBUG org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver - Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
2013-08-12 13:45:41,415 [main][][][][][][][] DEBUG org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver - Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
2013-08-12 13:45:41,416 [main][][][][][][][] DEBUG org.hibernate.validator.internal.xml.ValidationXmlParser - Trying to load META-INF/validation.xml for XML based Validator configuration.
2013-08-12 13:45:41,416 [main][][][][][][][] DEBUG org.hibernate.validator.internal.xml.ValidationXmlParser - No META-INF/validation.xml found. Using annotation based configuration only.
2013-08-12 13:45:41,425 [main][][][][][][][] TRACE org.hibernate.service.internal.AbstractServiceRegistryImpl - Initializing service [role=org.hibernate.event.service.spi.EventListenerRegistry]
2013-08-12 13:45:41,520 [main][][][][][][][] TRACE org.hibernate.service.internal.AbstractServiceRegistryImpl - Initializing service [role=org.hibernate.persister.spi.PersisterFactory]
2013-08-12 13:45:41,528 [main][][][][][][][] DEBUG org.hibernate.internal.SessionFactoryRegistry - Initializing SessionFactoryRegistry : org.hibernate.internal.SessionFactoryRegistry@24eced4a
2013-08-12 13:45:41,529 [main][][][][][][][] DEBUG org.hibernate.internal.SessionFactoryRegistry - Registering SessionFactory: e40b23c8-9c02-4432-8ac9-98d604a7e9d2 (<unnamed>)
2013-08-12 13:45:41,529 [main][][][][][][][] DEBUG org.hibernate.internal.SessionFactoryRegistry - Not binding SessionFactory to JNDI, no JNDI name configured
2013-08-12 13:45:41,529 [main][][][][][][][] DEBUG org.hibernate.internal.SessionFactoryImpl - Instantiated session factory
2013-08-12 13:45:41,530 [main][][][][][][][] DEBUG org.hibernate.internal.SessionFactoryImpl - Checking 4 named HQL queries
2013-08-12 13:45:41,530 [main][][][][][][][] DEBUG org.hibernate.internal.SessionFactoryImpl - Checking named query: customer.deleteByCustomerKey
2013-08-12 13:45:41,531 [main][][][][][][][] TRACE org.hibernate.engine.query.spi.QueryPlanCache - Unable to locate HQL query plan in cache; generating (DELETE FROM Customer c WHERE c.customerKey = :customerKey)
2013-08-12 13:45:41,574 [main][][][][][][][] DEBUG org.hibernate.hql.internal.ast.QueryTranslatorImpl - parse() - HQL: DELETE FROM Customer c WHERE c.customerKey = :customerKey
2013-08-12 13:45:41,584 [main][][][][][][][] DEBUG org.hibernate.hql.internal.ast.QueryTranslatorImpl - --- HQL AST ---
 \-[DELETE] Node: 'DELETE'
    +-[FROM] Node: 'FROM'
    |  \-[RANGE] Node: 'RANGE'
    |     +-[IDENT] Node: 'Customer'
    |     \-[ALIAS] Node: 'c'
    \-[WHERE] Node: 'WHERE'
       \-[EQ] Node: '='
          +-[DOT] Node: '.'
          |  +-[IDENT] Node: 'c'
          |  \-[IDENT] Node: 'customerKey'
          \-[COLON] Node: ':'
             \-[IDENT] Node: 'customerKey'

2013-08-12 13:45:41,584 [main][][][][][][][] DEBUG org.hibernate.hql.internal.ast.ErrorCounter - throwQueryException() : no errors
2013-08-12 13:45:41,613 [main][][][][][][][] DEBUG org.hibernate.hql.internal.antlr.HqlSqlBaseWalker - delete << begin [level=1, statement=delete]
2013-08-12 13:45:41,628 [main][][][][][][][] DEBUG org.hibernate.internal.SessionFactoryImpl - Checking named query: account.list
2013-08-12 13:45:41,629 [main][][][][][][][] TRACE org.hibernate.engine.query.spi.QueryPlanCache - Unable to locate HQL query plan in cache; generating (SELECT a FROM Account a, IN(a.customers) c WHERE c.customerKey = :customerKey ORDER BY a.accountNumber)
2013-08-12 13:45:41,630 [main][][][][][][][] DEBUG org.hibernate.hql.internal.ast.QueryTranslatorImpl - parse() - HQL: SELECT a FROM Account a, IN(a.customers) c WHERE c.customerKey = :customerKey ORDER BY a.accountNumber
2013-08-12 13:45:41,636 [main][][][][][][][] DEBUG org.hibernate.hql.internal.ast.QueryTranslatorImpl - --- HQL AST ---
 \-[QUERY] Node: 'query'
    +-[SELECT_FROM] Node: 'SELECT_FROM'
    |  +-[FROM] Node: 'FROM'
    |  |  +-[RANGE] Node: 'RANGE'
    |  |  |  +-[IDENT] Node: 'Account'
    |  |  |  \-[ALIAS] Node: 'a'
    |  |  \-[JOIN] Node: 'join'
    |  |     +-[INNER] Node: 'inner'
    |  |     +-[DOT] Node: '.'
    |  |     |  +-[IDENT] Node: 'a'
    |  |     |  \-[IDENT] Node: 'customers'
    |  |     \-[ALIAS] Node: 'c'
....
2013-08-12 13:45:41,651 [main][][][][][][][] DEBUG org.hibernate.hql.internal.ast.ErrorCounter - throwQueryException() : no errors
2013-08-12 13:45:41,652 [main][][][][][][][] DEBUG org.hibernate.hql.internal.antlr.HqlSqlBaseWalker - select << begin [level=1, statement=select]
2013-08-12 13:45:41,653 [main][][][][][][][] DEBUG org.hibernate.internal.SessionFactoryImpl - Checking 0 named SQL queries
2013-08-12 13:45:41,659 [main][][][][][][][] ERROR org.hibernate.internal.SessionFactoryImpl - HHH000177: Error in named query: customer.deleteByCustomerKey
org.hibernate.hql.internal.ast.QuerySyntaxException: Customer is not mapped [DELETE FROM Customer c WHERE c.customerKey = :customerKey]
        at org.hibernate.hql.internal.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180) ~[hibernate-core-4.2.3.Final.jar:4.2.3.Final]
        at org.hibernate.hql.internal.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:110) ~[hibernate-core-4.2.3.Final.jar:4.2.3.Final]
        at org.hibernate.hql.internal.ast.tree.FromClause.addFromElement(FromClause.java:93) ~[hibernate-core-4.2.3.Final.jar:4.2.3.Final]
        at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:324) ~[hibernate-core-4.2.3.Final.jar:4.2.3.Final]
        at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3420) ~[hibernate-c

However I see the classes are found:
2013-08-12 13:45:39,957 [main][][][][][][][] DEBUG org.hibernate.ejb.Ejb3Configuration - Detect class: true; detect hbm: true
2013-08-12 13:45:39,968 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Searching mapped entities in jar/par: file:/home/et2448/projects/tac/jfr/server/jfr-srv-model/target/jfr-srv-mode
l-3.0-SNAPSHOT.jar
2013-08-12 13:45:39,969 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - File Filter matched for META-INF/orm.xml
2013-08-12 13:45:39,970 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.CurrencyAndAmount_
2013-08-12 13:45:40,017 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.customer.Customer$CustomerKey
2013-08-12 13:45:40,019 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Java element filter matched for com.edb.fs.tac.jfr.srv.model.customer.Customer$CustomerKey
2013-08-12 13:45:40,019 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.customer.Customer_
2013-08-12 13:45:40,020 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.customer.Customer
2013-08-12 13:45:40,022 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Java element filter matched for com.edb.fs.tac.jfr.srv.model.customer.Customer
2013-08-12 13:45:40,023 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.AbstractEntity_
2013-08-12 13:45:40,023 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.CurrencyAndAmount
2013-08-12 13:45:40,024 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Java element filter matched for com.edb.fs.tac.jfr.srv.model.CurrencyAndAmount
2013-08-12 13:45:40,025 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.AbstractEntity
2013-08-12 13:45:40,026 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Java element filter matched for com.edb.fs.tac.jfr.srv.model.AbstractEntity
2013-08-12 13:45:40,026 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.account.Account_
2013-08-12 13:45:40,027 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.account.Account
2013-08-12 13:45:40,028 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Java element filter matched for com.edb.fs.tac.jfr.srv.model.account.Account
2013-08-12 13:45:40,029 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.address.Address
2013-08-12 13:45:40,030 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Java element filter matched for com.edb.fs.tac.jfr.srv.model.address.Address
2013-08-12 13:45:40,031 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.address.Address_
2013-08-12 13:45:40,031 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.dhub.FileSequenceNumber
2013-08-12 13:45:40,032 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Java element filter matched for com.edb.fs.tac.jfr.srv.model.dhub.FileSequenceNumber
2013-08-12 13:45:40,033 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.dhub.FileSequenceNumber$FileSequenceNumberPk
2013-08-12 13:45:40,034 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Java element filter matched for com.edb.fs.tac.jfr.srv.model.dhub.FileSequenceNumber$FileSequenceNumberPk
2013-08-12 13:45:40,034 [main][][][][][][][] DEBUG org.hibernate.ejb.packaging.AbstractJarVisitor - Filtering: com.edb.fs.tac.jfr.srv.model.dhub.FileSequenceNumber_
2013-08-12 13:45:40,067 [main][][][][][][][] TRACE org.hibernate.cfg.EJB3DTDEntityResolver - Resolving XML entity null : file:///home/et2448/projects/tac/jfr/server/jfr-srv-service/orm_2_0.xsd
2013-08-12 13:45:40,067 [main][][][][][][][] DEBUG org.hibernate.internal.util.xml.DTDEntityResolver - Trying to resolve system-id [file:///home/et2448/projects/tac/jfr/server/jfr-srv-service/orm_2_0.xsd]
2013-08-12 13:45:40,067 [main][][][][][][][] TRACE org.hibernate.cfg.EJB3DTDEntityResolver - Recognized JPA ORM namespace; attempting to resolve on classpath under org/hibernate/ejb
2013-08-12 13:45:40,068 [main][][][][][][][] TRACE org.hibernate.cfg.EJB3DTDEntityResolver - Located [file:///home/et2448/projects/tac/jfr/server/jfr-srv-service/orm_2_0.xsd] in classpath
2013-08-12 13:45:40,138 [main][][][][][][][] DEBUG org.hibernate.integrator.internal.IntegratorServiceImpl - Adding Integrator [org.hibernate.cfg.beanvalidation.BeanValidationIntegrator].
2013-08-12 13:45:40,138 [main][][][][][][][] DEBUG org.hibernate.integrator.internal.IntegratorServiceImpl - Adding Integrator [org.hibernate.ejb.event.JpaIntegrator].
2013-08-12 13:45:40,171 [main][][][][][][][] DEBUG org.hibernate.ejb.util.NamingHelper - No JNDI name configured for binding Ejb3Configuration
2013-08-12 13:45:40,184 [main][][][][][][][] DEBUG org.hibernate.cfg.Configuration - Preparing to build session factory with filters : {}
2013-08-12 13:45:40,185 [main][][][][][][][] TRACE org.hibernate.service.internal.AbstractServiceRegistryImpl - Initializing service [role=org.hibernate.engine.jdbc.spi.JdbcServices]
2013-08-12 13:45:40,196 [main][][][][][][][] TRACE org.hibernate.service.internal.AbstractServiceRegistryImpl - Initializing service [role=org.hibernate.service.jdbc.connections.spi.ConnectionProvider]
2013-08-12 13:45:40,196 [main][][][][][][][] INFO org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator - HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider

Hibernate EM version:
<hibernate.entitymanager.version>4.2.3.Final</hibernate.entitymanager.version>

My configuration:

	<bean id="localContainerEntityManagerFactoryBean"
		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
				<property name="generateDdl" value="false" />
				<property name="showSql" value="${hibernate.show_sql}" />
				<property name="database">
					<util:constant static-field="org.springframework.orm.jpa.vendor.Database.ORACLE" />
				</property>
				<property name="databasePlatform" value="${hibernate.dialect}" />
			</bean>
		</property>
		<property name="jpaProperties">
			<props>
				<!-- if enabling 2nd level cache based on ehcache: <prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</prop> 
					<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</prop> 
					<prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop> 
					<prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop> 
					<prop key="hibernate.cache.use_structured_entries">${hibernate.cache.use_structured_entries}</prop> -->
				<!-- if JTA/XA by using atomikos tx mgr: <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop> -->
				<prop key="javax.persistence.validation.group.pre-persist">javax.validation.groups.Default</prop>
				<prop key="javax.persistence.validation.group.pre-update">javax.validation.groups.Default</prop>
				<prop key="javax.persistence.validation.group.pre-remove">javax.validation.groups.Default</prop>
				<prop key="hibernate.generate_statistics">${hibernate.generate_statistics}</prop>
				<prop key="hibernate.jdbc.use_get_generated_keys">${hibernate.jdbc.use_get_generated_keys}</prop>
				<prop key="hibernate.jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop>
				<prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
				<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
				<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
				<prop key="hibernate.use_sql_comments">${hibernate.use_sql_comments}</prop>
			</props>
		</property>

	</bean>

Affects: 4.0 M2

Issue Links:

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions