[jboss-user] [JBoss Seam] - 'HibernateException: Errors in named queries' running tests

sradford do-not-reply at jboss.com
Sat Nov 10 17:45:20 EST 2007


Hi,

Anyone got any idea what could be causing this problem...

I have a small Seam project using Seam 2.0.0.GA with a simple test with an entity with a simple named query. Now all works fine when I run my test within Eclipse - the micro-container is instantiated and the test runs successfully. However, when I try to run from the command line, deployment fails stating there is a problem with the named query!


  | ERROR 10-11 22:06:08,616  [org.jboss.dependency.plugins.AbstractController.incrementState():456] Error installing to Start: name=persistence.units:jar=test-build.jar,unitName=mytestproject state=Create
  |    [testng] javax.persistence.PersistenceException: org.hibernate.HibernateException: Errors in named queries: user.isEmailInUse, user.byEmail
  |    [testng]     at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
  |    [testng]     at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
  |    [testng]     at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |    [testng]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |    [testng]     at java.lang.reflect.Method.invoke(Method.java:597)
  |    [testng]     at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
  |    [testng]     at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:108)
  |    [testng]     at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
  |    [testng]     at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:103)
  |    [testng]     at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:145)
  |    [testng]     at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:197)
  |    [testng]     at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.install(KernelControllerContextAction.java:136)
  |    [testng]     at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
  |    [testng]     at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:233)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:724)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:445)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:555)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:489)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:289)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:192)
  |    [testng]     at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:84)
  |    [testng]     at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:78)
  |    [testng]     at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:141)
  |    [testng]     at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:519)
  |    [testng]     at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:324)
  |    [testng]     at org.jboss.ejb3.deployers.EJBStage2Deployer.deploy(EJBStage2Deployer.java:54)
  |    [testng]     at org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer.commitDeploy(AbstractSimpleDeployer.java:52)
  |    [testng]     at org.jboss.deployers.plugins.deployer.DeployerWrapper.commitDeploy(DeployerWrapper.java:170)
  |    [testng]     at org.jboss.deployers.plugins.deployment.MainDeployerImpl.commitDeploy(MainDeployerImpl.java:592)
  |    [testng]     at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainDeployerImpl.java:476)
  |    [testng]     at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainDeployerImpl.java:406)
  |    [testng]     at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:128)
  |    [testng]     at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:307)
  |    [testng]     at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:14)
  |    [testng]     at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:1006)
  |    [testng]     at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:931)
  |    [testng]     at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |    [testng]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |    [testng]     at java.lang.reflect.Method.invoke(Method.java:597)
  |    [testng]     at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
  |    [testng]     at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:394)
  |    [testng]     at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
  |    [testng]     at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
  |    [testng]     at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:165)
  |    [testng]     at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
  |    [testng]     at org.testng.TestRunner.runWorkers(TestRunner.java:678)
  |    [testng]     at org.testng.TestRunner.privateRun(TestRunner.java:624)
  |    [testng]     at org.testng.TestRunner.run(TestRunner.java:495)
  |    [testng]     at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
  |    [testng]     at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
  |    [testng]     at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
  |    [testng]     at org.testng.SuiteRunner.run(SuiteRunner.java:190)
  |    [testng]     at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
  |    [testng]     at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
  |    [testng]     at org.testng.TestNG.run(TestNG.java:699)
  |    [testng]     at org.testng.TestNG.privateMain(TestNG.java:824)
  |    [testng]     at org.testng.TestNG.main(TestNG.java:802)
  |    [testng] Caused by: org.hibernate.HibernateException: Errors in named queries: user.byEmail
  |    [testng]     at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:364)
  |    [testng]     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291)
  |    [testng]     at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
  |    [testng]     ... 60 more
  | 

The 'offending' named queries are:

@NamedQuery(name = 'user.byEmail', query="select u from user u where u.personalDetails.email = :email"),

If I modify the query, removing its where clause it deploys.

By the way, personalDetails is an embedded element.

*********
OK - I've sorted the problem. Will post it as a reply after this for others.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103446#4103446

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103446



More information about the jboss-user mailing list