Hello
Can somebody help me with this error? I am trying to run the example given by
http://www.systemmobile.com/articles/In ... rnate.html
i did not change anything in the two mapping files ( team and player ).....
C:\hibernate-2.1\hibernate_intro>ant run-tests
Buildfile: build.xml
build:
run-tests:
[junit] Running example.test.TeamDAOTest
[junit] %%%% Error Creating SessionFactory %%%%
[junit] example.persistence.DAOException:
duplicate import: Player wraps: [net.sf.hibernate.MappingException: duplicate
[junit] at example.persistence.HibernateSession.loadClasses(HibernateSession.java:84)
[junit] at example.persistence.HibernateSession.currentSession(HibernateSession.java:32)
[junit] at example.persistence.BaseDAO.retrieveObjs(BaseDAO.java:114)
[junit] at example.persistence.TeamDAO.searchTeams(TeamDAO.java:43)
[junit] at example.test.TeamDAOTest.testSelectTeams(TeamDAOTest.java:88)
[junit] at java.lang.reflect.Method.invoke(Native Method)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)
[junit] at junit.framework.TestCase.runBare(TestCase.java:127)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:536)
[junit] net.sf.hibernate.MappingException: duplicate import: Player
[junit] at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60)
[junit] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:106)
[junit] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:163)
[junit] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1076)
[junit] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
[junit] at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
[junit] at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:286)
[junit] at example.persistence.HibernateSession.loadClasses(HibernateSession.java:81)
[junit] at example.persistence.HibernateSession.currentSession(HibernateSession.java:32)
[junit] at example.persistence.BaseDAO.retrieveObjs(BaseDAO.java:114)
[junit] at example.persistence.TeamDAO.searchTeams(TeamDAO.java:43)
[junit] at example.test.TeamDAOTest.testSelectTeams(TeamDAOTest.java:88)
[junit] at java.lang.reflect.Method.invoke(Native Method)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)
[junit] at junit.framework.TestCase.runBare(TestCase.java:127)
[junit] %%%% wrapped exception: Tests run: 2, Failures: 2, Errors: 0, Time elapsed: 1.141 sec
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:536)
[junit] TEST example.test.TeamDAOTest FAILED
[junit] Running example.test.PlayerDAOTest
[junit] %%%% Error Creating SessionFactory %%%%
[junit] example.persistence.DAOException: duplicate import: Player wraps: [net.sf.hibernate.MappingException: duplicate
[junit] at example.persistence.HibernateSession.loadClasses(HibernateSession.java:84)
[junit] at example.persistence.HibernateSession.currentSession(HibernateSession.java:32)
[junit] at example.persistence.BaseDAO.retrieveObjs(BaseDAO.java:114)
[junit] at example.persistence.PlayerDAO.searchPlayers(PlayerDAO.java:43)
[junit] at example.test.PlayerDAOTest.testSelectPlayers(PlayerDAOTest.java:65)
[junit] at java.lang.reflect.Method.invoke(Native Method)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)
[junit] at junit.framework.TestCase.runBare(TestCase.java:127)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:536)
[junit] net.sf.hibernate.MappingException: duplicate import: Player
[junit] at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60)
[junit] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:106)
[junit] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:163)
[junit] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1076)
[junit] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
[junit] at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
[junit] at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:286)
[junit] at example.persistence.HibernateSession.loadClasses(HibernateSession.java:81)
[junit] at example.persistence.HibernateSession.currentSession(HibernateSession.java:32)
[junit] at example.persistence.BaseDAO.retrieveObjs(BaseDAO.java:114)
[junit] at example.persistence.PlayerDAO.searchPlayers(PlayerDAO.java:43)
[junit] at example.test.PlayerDAOTest.testSelectPlayers(PlayerDAOTest.java:65)
[junit] at java.lang.reflect.Method.invoke(Native Method)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)
[junit] at junit.framework.TestCase.runBare(TestCase.java:127)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] %%%% wrapped exception: Tests run: 2, Failures: 2, Errors: 0, Time elapsed: 1.219 sec
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:536)
[junit] TEST example.test.PlayerDAOTest FAILED
BUILD SUCCESSFUL
Total time: 3 seconds
C:\hibernate-2.1\hibernate_intro>