[ http://issues.apache.org/jira/browse/DAYTRADER-14?page=comments#action_12441226 ] Piyush Agarwal commented on DAYTRADER-14: -----------------------------------------
After looking at the code I think we can lookup the database product name using DatabaseMetaData and based on that read a specific DDL file to drop and recreate the db tables. This will account for the differences in schemas of the various database vendors like Derby, db2, oracle etc. It will also save us from hard-coding those DDL-SQL in the application and having a nightmare everytime we change/update the database schema. The DDL files will be packaged at a specific location within the Daytrader web.war file (say something like web.war/WEB-INF/dbscripts/ folder). Right now we can detect and provide DDL files for databases like Db2, derby and oracle ("tested" databases); for any other "un-tested" database we can make a provision for the user to supply the DDL at a location like web.war/WEB-INF/dbscripts/OTHER/Table.ddl and it will be executed. > Include sql script in the ear and use a gbean to create tables etc > ------------------------------------------------------------------ > > Key: DAYTRADER-14 > URL: http://issues.apache.org/jira/browse/DAYTRADER-14 > Project: DayTrader > Issue Type: Improvement > Components: EJB Tier > Affects Versions: 1.2 > Reporter: David Jencks > Attachments: d-j-plan.xml, DAYTRADER-14.patch > > > You can use the DatabaseIntitializationGBean (GERONIMO-2396) in a g. plan and > include the sql script in the ejb module so the database will get created if > not already present. This is way better than the previous hack of including a > pre-built database in the car file. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira