Make sure you're editing the correct file. In other words, delete the one in
src/test/resources and modify the one in src/main/resources.

On Wed, Sep 9, 2009 at 3:30 PM, measwel <marek_karczew...@yahoo.com.au>wrote:

>
> I have generated and installed a new Person pojo using mvn appfuse:gen to
> test it out.
> And the result is throwing exceptions. I have checked the hibernate config
> xml file and the new entity seems to be registered there:
>
> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate
> Configuration DTD 3.0//EN"
>    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";>
>
> <hibernate-configuration>
>    <session-factory>
>        <mapping class="com.hw.app.model.User"/>
>        <mapping class="com.hw.app.model.Role"/>
>        <mapping class="com.hw.app.model.Person"/>
>    </session-factory>
> </hibernate-configuration>
>
> The output of the run:
>
>
> -------------------------------------------------------------------------------
> Test set: com.hw.app.webapp.action.PersonActionTest
>
> -------------------------------------------------------------------------------
> Tests run: 4, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 0.128 sec
> <<< FAILURE!
> testSearch(com.hw.app.webapp.action.PersonActionTest)  Time elapsed: 0.064
> sec  <<< ERROR!
> org.springframework.orm.hibernate3.HibernateSystemException: Unknown
> entity:
> com.hw.app.model.Person; nested exception is
> org.hibernate.MappingException:
> Unknown entity: com.hw.app.model.Person
>        at
>
> org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:661)
>        at
>
> org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
>        at
>
> org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
>        at
>
> org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
>        at
>
> org.springframework.orm.hibernate3.HibernateTemplate.merge(HibernateTemplate.java:820)
>        at
>
> com.hw.app.dao.hibernate.GenericDaoHibernate.save(GenericDaoHibernate.java:95)
>        at
> com.hw.app.service.impl.GenericManagerImpl.save(GenericManagerImpl.java:89)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
>
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
>        at
>
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>        at
>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>        at
>
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>        at
>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>        at
>
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
>        at
>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>        at
>
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>        at $Proxy36.save(Unknown Source)
>        at
>
> com.hw.app.webapp.action.PersonActionTest.onSetUpBeforeTransaction(PersonActionTest.java:25)
>        at
>
> org.springframework.test.AbstractTransactionalSpringContextTests.onSetUp(AbstractTransactionalSpringContextTests.java:216)
>        at
>
> org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:103)
>        at junit.framework.TestCase.runBare(TestCase.java:132)
>        at
>
> org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
>        at junit.framework.TestResult$1.protect(TestResult.java:110)
>        at junit.framework.TestResult.runProtected(TestResult.java:128)
>        at junit.framework.TestResult.run(TestResult.java:113)
>        at junit.framework.TestCase.run(TestCase.java:124)
>        at junit.framework.TestSuite.runTest(TestSuite.java:232)
>        at junit.framework.TestSuite.run(TestSuite.java:227)
>        at
>
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
>        at
>
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>        at
>
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>        at
>
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
>
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>        at
>
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
> Caused by: org.hibernate.MappingException: Unknown entity:
> com.hw.app.model.Person
>        at
>
> org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)
>        at
> org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)
>        at
>
> org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:97)
>        at
>
> org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
>        at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
>        at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
>        at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
>        at
>
> org.springframework.orm.hibernate3.HibernateTemplate$23.doInHibernate(HibernateTemplate.java:823)
>        at
>
> org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
>        ... 39 more
>
> What is wrong?
> --
> View this message in context:
> http://www.nabble.com/generated-class-throws-exceptions-tp25373508s2369p25373508.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>
>

Reply via email to