Errors in named queries: findByName in JBoss AS7 with Hibernate 3.6 and OJdbc6

523 views Asked by At

I am trying to migrate ejb application from OC4J to JBoss AS7, Application is using OJdbc 6 and Hibernate 3, As Jboss runs on Hibernate 4, so I configured JBoss to support Hibernate 3.6. However while deploying the ear i am getting below error in console(Application is using Oracle 11g as database):

19:23:21,794 INFO  [org.hibernate.cfg.Configuration] (ServerService Thread Pool -- 51) Hibernate Validator not found: ignoring
19:23:21,893 INFO  [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 51) HV000001: Hibernate Validator 4.3.2.Final-redhat-1
19:23:22,131 INFO  [org.hibernate.cfg.search.HibernateSearchEventListenerRegister] (ServerService Thread Pool -- 51) Unable to find org.hibernate.search.event.F
ullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
19:23:22,146 INFO  [org.hibernate.connection.ConnectionProviderFactory] (ServerService Thread Pool -- 51) Initializing connection provider: org.hibernate.ejb.co
nnection.InjectedDataSourceConnectionProvider
19:23:22,160 INFO  [org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider] (ServerService Thread Pool -- 51) Using provided datasource
19:23:23,995 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Database ->
       name : Oracle
    version : Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning option
      major : 11
      minor : 2
19:23:24,026 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Driver ->
       name : Oracle JDBC driver
    version : 11.2.0.4.0
      major : 11
      minor : 2
19:23:24,076 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 51) Using dialect: org.hibernate.dialect.Oracle10gDialect
19:23:24,369 INFO  [org.hibernate.transaction.TransactionFactoryFactory] (ServerService Thread Pool -- 51) Transaction strategy: org.hibernate.ejb.transaction.J
oinableCMTTransactionFactory
19:23:24,379 INFO  [org.hibernate.transaction.TransactionManagerLookupFactory] (ServerService Thread Pool -- 51) instantiating TransactionManagerLookup: org.jbo
ss.as.jpa.hibernate3.JBossAppServerJtaPlatform
19:23:24,395 INFO  [org.hibernate.transaction.TransactionManagerLookupFactory] (ServerService Thread Pool -- 51) instantiated TransactionManagerLookup
19:23:24,401 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Automatic flush during beforeCompletion(): disabled
19:23:24,407 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Automatic session close at end of transaction: disabled
19:23:24,413 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) JDBC batch size: 15
19:23:24,421 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) JDBC batch updates for versioned data: disabled
19:23:24,430 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Scrollable result sets: enabled
19:23:24,436 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) JDBC3 getGeneratedKeys(): disabled
19:23:24,443 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Connection release mode: auto
19:23:24,449 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Default batch fetch size: 1
19:23:24,455 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Generate SQL with comments: disabled
19:23:24,463 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Order SQL updates by primary key: disabled
19:23:24,471 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Order SQL inserts for batching: disabled
19:23:24,478 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
19:23:24,488 INFO  [org.hibernate.hql.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 51) Using ASTQueryTranslatorFactory
19:23:24,494 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Query language substitutions: {}
19:23:24,500 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) JPA-QL strict compliance: enabled
19:23:24,506 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Second-level cache: enabled
19:23:24,511 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Query cache: disabled
19:23:24,518 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
19:23:24,529 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Optimize cache for minimal puts: disabled
19:23:24,535 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Structured second-level cache entries: disabled
19:23:24,547 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Statistics: disabled
19:23:24,553 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Deleted entity synthetic identifier rollback: disabled
19:23:24,559 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Default entity-mode: pojo
19:23:24,566 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Named query checking : enabled
19:23:24,573 INFO  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 51) Check Nullability in Core (should be disabled when Bean Validation is o
n): disabled
19:23:24,600 INFO  [org.hibernate.impl.SessionFactoryImpl] (ServerService Thread Pool -- 51) building session factory
19:23:24,610 INFO  [org.hibernate.type.BasicTypeRegistry] (ServerService Thread Pool -- 51) Type registration [wrapper_materialized_blob] overrides previous : o
rg.hibernate.type.WrappedMaterializedBlobType@1e65667
19:23:24,619 INFO  [org.hibernate.type.BasicTypeRegistry] (ServerService Thread Pool -- 51) Type registration [materialized_blob] overrides previous : org.hiber
nate.type.MaterializedBlobType@132a704
19:23:24,633 INFO  [org.hibernate.type.BasicTypeRegistry] (ServerService Thread Pool -- 51) Type registration [blob] overrides previous : org.hibernate.type.Blo
bType@731c20
19:23:24,644 INFO  [org.hibernate.type.BasicTypeRegistry] (ServerService Thread Pool -- 51) Type registration [java.sql.Blob] overrides previous : org.hibernate
.type.BlobType@731c20
19:23:24,656 INFO  [org.hibernate.type.BasicTypeRegistry] (ServerService Thread Pool -- 51) Type registration [clob] overrides previous : org.hibernate.type.Clo
bType@13ba11c
19:23:24,671 INFO  [org.hibernate.type.BasicTypeRegistry] (ServerService Thread Pool -- 51) Type registration [java.sql.Clob] overrides previous : org.hibernate
.type.ClobType@13ba11c
19:23:24,684 INFO  [org.hibernate.type.BasicTypeRegistry] (ServerService Thread Pool -- 51) Type registration [materialized_clob] overrides previous : org.hiber
nate.type.MaterializedClobType@1ce6a36
19:23:24,696 INFO  [org.hibernate.type.BasicTypeRegistry] (ServerService Thread Pool -- 51) Type registration [characters_clob] overrides previous : org.hiberna
te.type.PrimitiveCharacterArrayClobType@9f3eba
19:23:24,708 INFO  [org.hibernate.type.BasicTypeRegistry] (ServerService Thread Pool -- 51) Type registration [wrapper_characters_clob] overrides previous : org
.hibernate.type.CharacterArrayClobType@cf3c39
19:23:24,775 INFO  [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 51) no default (no-argument) constructor for class: com.tmobile.itnetdev
.fixedbuild.vminfra.business.searchresults.VmsearchResultsCMPBean (class must be instantiated by Interceptor)
19:23:24,839 INFO  [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 51) no default (no-argument) constructor for class: com.tmobile.itnetdev
.fixedbuild.vminfra.business.searchresults.InfEquipmentRoomsCMPBean (class must be instantiated by Interceptor)
19:23:24,863 INFO  [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 51) no default (no-argument) constructor for class: com.tmobile.itnetdev
.fixedbuild.vminfra.business.searchresults.PmnotificationsCMPBean (class must be instantiated by Interceptor)
19:23:24,883 INFO  [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 51) no default (no-argument) constructor for class: com.tmobile.itnetdev
.fixedbuild.vminfra.business.searchresults.InfStandortalternativenCMPBean (class must be instantiated by Interceptor)
19:23:24,927 INFO  [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 51) no default (no-argument) constructor for class: com.tmobile.itnetdev
.fixedbuild.vminfra.business.searchresults.InfAdressenCMPBean (class must be instantiated by Interceptor)
19:23:24,947 INFO  [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 51) no default (no-argument) constructor for class: com.tmobile.itnetdev
.fixedbuild.vminfra.business.searchresults.VmsearchResultHeadCMPBean (class must be instantiated by Interceptor)
19:23:24,999 INFO  [org.hibernate.impl.SessionFactoryObjectFactory] (ServerService Thread Pool -- 51) Not binding factory to JNDI, no JNDI name configured
19:23:25,052 ERROR [org.hibernate.hql.PARSER] (ServerService Thread Pool -- 51) line 1:77: unexpected token: :
19:23:25,058 WARN  [org.hibernate.hql.ast.HqlParser] (ServerService Thread Pool -- 51) processEqualityExpression() : No expression to process!
19:23:25,065 ERROR [org.hibernate.impl.SessionFactoryImpl] (ServerService Thread Pool -- 51) Error in named query: findByName: org.hibernate.hql.ast.QuerySyntax
Exception: unexpected token: : near line 1, column 77 [SELECT OBJECT(alt) FROM InfStandortalternativenCMP AS alt WHERE alt.alteName:alternativenname]
        at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:284) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:549) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:413) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842) [hibernate-core-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902) [hibernate-entitymanager-3.6.1.Final.jar:3.6.1.Final]
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) [hibernate-entitymanager-3.6.1.Final.jar:3.6
.1.Final]
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200) [jboss-as-jpa-7.4.2.Fina
l-redhat-2.jar:7.4.2.Final-redhat-2]
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57) [jboss-as-jpa-7.4.2.Final-redhat-2.jar:7.4.2.Final
-redhat-2]
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99) [jboss-as-jpa-7.4.2.Final-redhat-2.jar:7.4.2.Final-redh
at-2]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_18]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_18]
        at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_18]
        at org.jboss.threads.JBossThread.run(JBossThread.java:122)

19:23:25,238 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 51) MSC000001: Failed to start service jboss.persistenceunit."demo.ear/pegabas
e-fixedbuild-ejb.jar#manager1": org.jboss.msc.service.StartException in service jboss.persistenceunit."demo.ear/demo-fixedbuild-ejb.jar#manager1": javax
.persistence.PersistenceException: [PersistenceUnit: manager1] Unable to build EntityManagerFactory
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_18]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_18]
        at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_18]
        at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: manager1] Unable to build EntityManagerFactory
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:911)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
        ... 4 more
Caused by: org.hibernate.HibernateException: Errors in named queries: findByName
        at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:426)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902)
        ... 8 more

19:23:25,459 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 26) JBAS018559: Deployed "demo.ear" (runtime-name : "demo.ear")
19:23:25,468 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.naming.context.java.jboss.resources.jdbc.demoManagementDataSource (missing) dependents: [service jboss.naming.context.java.comp.demo
.demo-framework-ejb.demo/framework/PerformanceMeasurementHome.env.jdbc.demoManagementDataSource, service jboss.naming.context.java.comp.demo.peg
abase-framework-ejb.demo/framework/VisualizationEnvironmentHome.env.jdbc.demoManagementDataSource, service jboss.naming.context.java.comp.demo.test-framework-ejb.demo/framework/UseCaseHome.env.jdbc.demoManagementDataSource]
JBAS014777:   Services which failed to start:      service jboss.persistenceunit."demo.ear/demo-fixedbuild-ejb.jar#manager1": org.jboss.msc.service.Star
tException in service jboss.persistenceunit."demo.ear/demo-fixedbuild-ejb.jar#manager1": javax.persistence.PersistenceException: [PersistenceUnit: manag
er1] Unable to build EntityManagerFactory

19:23:25,628 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
19:23:25,631 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
19:23:25,639 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss EAP 6.3.2.GA (AS 7.4.2.Final-redhat-2) started (with errors) in 24156ms - Started 2
087 of 2232 services (108 services failed or missing dependencies, 99 services are lazy, passive or on-demand)
1

There are 1 answers

0
Predrag Maric On

You seem to have an error in your query, which is

SELECT OBJECT(alt) FROM InfStandortalternativenCMP AS alt WHERE alt.alteName:alternativenname

and should be

SELECT OBJECT(alt) FROM InfStandortalternativenCMP AS alt WHERE alt.alteName = :alternativenname