This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

-------------------------------------------------------------------------------
Test set: blog.jpa.dao.JpaRestaurantDaoTestCase
-------------------------------------------------------------------------------
Tests run: 10, Failures: 0, Errors: 10, Skipped: 0, Time elapsed: 22.765 sec <<< FAILURE!
testFindByIdWhereRestaurantExists(blog.jpa.dao.JpaRestaurantDaoTestCase) Time elapsed: 22.578 sec <<< ERROR!
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [insert into address (id, street_number, street_name) values (1, 10, 'Main Street')]; nested exception is java.sql.SQLException: Table not found in statement [insert into address]
Caused by: java.sql.SQLException: Table not found in statement [insert into address]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.execute(Unknown Source)
at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:336)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:310)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:343)
at blog.jpa.dao.JpaRestaurantDaoTestCase.onSetUpInTransaction(JpaRestaurantDaoTestCase.java:23)
at org.springframework.test.AbstractTransactionalSpringContextTests.onSetUp(AbstractTransactionalSpringContextTests.java:170)
at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:77)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$001(AbstractAnnotationAwareTransactionalTests.java:44)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run(AbstractAnnotationAwareTransactionalTests.java:112)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:177)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed(AbstractAnnotationAwareTransactionalTests.java:150)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:108)
at org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:160)
at org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:239)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:160)
at org.apache.maven.surefire.Surefire.run(Surefire.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:182)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:743)

Same exception was thrown for all the test methods.

In my earlier post here, I mentioned using aspects with the aforesaid example, and had a maven project (maven version 2.0.4), where I was using LTW as well as CTW with spring-2.0-rc2 jars(with an earlier build version of toplink), everything worked fine,(I am still stuck with the problem of upgrading the jars from RC2 to 2.0) but the same environment is not supported in this case!

The exception indicates that the db schema is not up to date - the address table is missing. I haven't tried Mark's blog so can you post your webapp? Btw, can try running without maven - several users reported problems lately which were caused by 'hidden' dependencies which were pulled by maven and used instead of the one mentioned by the user (this might be or not the case here).
You mention also a problem with a LTW - can you be more precise? The exception above is caused by the database structure not the way classes are loaded.

Comment

Thanks Costin for replying to this post. I am attaching the code which I am using right now. For the simple eclipse project everything works out to be fine. As pointed out by you that the ADDRESS table is not present, what I figured out was that when I try executing the test case (of the maven setup), the generateDdl doesn't work and that's the source of the problem. I simply cannot understand why is this happening.

Following is the console output of both the setups:
1. For simple eclipse project