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
Code:
2006-11-13 11:54:05,375 INFO [org.springframework.jdbc.datasource.DriverManagerDataSource] - <Loaded JDBC driver: org.hsqldb.jdbcDriver>
[TopLink Config]: 2006.11.13 11:54:05.921--ServerSession(25352765)--Thread(Thread[main,5,main])--The alias name for the entity class [class blog.jpa.domain.Address] is being defaulted to: Address.
[TopLink Config]: 2006.11.13 11:54:05.953--ServerSession(25352765)--Thread(Thread[main,5,main])--The table name for entity [class blog.jpa.domain.Address] is being defaulted to: ADDRESS.
[TopLink Config]: 2006.11.13 11:54:05.984--ServerSession(25352765)--Thread(Thread[main,5,main])--The column name for element [private long blog.jpa.domain.Address.id] is being defaulted to: ID.
[TopLink Config]: 2006.11.13 11:54:06.015--ServerSession(25352765)--Thread(Thread[main,5,main])--The alias name for the entity class [class blog.jpa.domain.Restaurant] is being defaulted to: Restaurant.
........
........
11:49:50.343--ServerSession(25352765)--Thread(Thread[main,5,main])--file:/D:/Jayant/codes/markfisher-blog-example-eclipse/bin/-SpringJpaGettingStarted login successful
[TopLink Fine]: 2006.11.13 11:49:50.375--ServerSession(25352765)--Connection(30340343)--Thread(Thread[main,5,main])--CREATE TABLE RESTAURANT_ENTREE (Restaurant_ID NUMERIC(19) NOT NULL, ENTREE_ID NUMERIC(19) NOT NULL, PRIMARY KEY (Restaurant_ID, ENTREE_ID))
[TopLink Fine]: 2006.11.13 11:49:50.390--ServerSession(25352765)--Connection(13748088)--Thread(Thread[main,5,main])--CREATE TABLE ENTREE (ID NUMERIC(19) NOT NULL, NAME VARCHAR(255), VEGETARIAN TINYINT, PRIMARY KEY (ID))
[TopLink Fine]: 2006.11.13 11:49:50.390--ServerSession(25352765)--Connection(8303462)--Thread(Thread[main,5,main])--CREATE TABLE RESTAURANT (ID NUMERIC(19) NOT NULL, NAME VARCHAR(255), ADDRESS_ID NUMERIC(19), PRIMARY KEY (ID))
[TopLink Fine]: 2006.11.13 11:49:50.390--ServerSession(25352765)--Connection(3403998)--Thread(Thread[main,5,main])--CREATE TABLE ADDRESS (ID NUMERIC(19) NOT NULL, STREET_NUMBER INTEGER, STREET_NAME VARCHAR(255), PRIMARY KEY (ID))
[TopLink Fine]: 2006.11.13 11:49:50.390--ServerSession(25352765)--Connection(12644844)--Thread(Thread[main,5,main])--CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT NUMERIC(38), PRIMARY KEY (SEQ_NAME))
For maven setup
Code:
2006-11-13 11:55:16,875 INFO [org.springframework.jdbc.datasource.DriverManagerDataSource] - <Loaded JDBC driver: org.hsqldb.jdbcDriver>
[TopLink Config]: 2006.11.13 11:52:12.500--ServerSession(3874052)--Connection(30533424)--Thread(Thread[main,5,main])--Connected: jdbc:hsqldb:mem:testdb
User: SA
Database: HSQL Database Engine Version: 1.8.0
Driver: HSQL Database Engine Driver Version: 1.8.0
[TopLink Info]: 2006.11.13 11:52:12.531--ServerSession(3874052)--Thread(Thread[main,5,main])--file:/D:/Jayant/codes/markfisher-blog-example-maven/target/test-classes/-SpringJpaGettingStarted login successful
2006-11-13 11:52:12,609 INFO [blog.jpa.dao.JpaRestaurantDaoTestCase] - <Began transaction (1): transaction manager [org.springframework.orm.jpa.JpaTransactionManager@71dc3d]; default rollback = true>
2006-11-13 11:52:12,640 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]>
Notice the entities being mapped to respective tables and the create stmts in the first case, this seems to the source of the problem in the second case but the reason is still not known.
Regarding LTW, in this case it is not required, I had written this wrt to this post of mine.
Please take out some time and have a look at this problem.
Thanks,
Jayant