This one time, at band camp, bikehead said:
Brian,
Please see my comments inline.
b>I'm starting to experiment with Castor and am setting up a simple
b>mapping from a Java object to an in-memory hypersonic DB. I seem to get
b>the JDO and Database object setup correctly, but when I go to create my
b>first object, I get an error that the underlying table doesn't exist.
b>
b>Obviously this makes sense. My question is: what is the best way to
b>create the underlying tables. Since this an in-memory DB, I can run a
b>script once and expect the tables to always be there. I have to create
b>them each time. After hunting around there seems to be a couple of options:
b>
b>1. Cast my Database object to a DatabaseImpl and get the underlying JDBC
b>connection. Use this to issue my custom SQL creates.
This is certainly one method of achieving your end result.
b>2. Use the sql pass through of OQL. However, all the examples I have
b>seen so far show a select retreiving into some object. Is it ok to do
b>the 'create table' even though it doesn't return anything? Can I just
b>set the 'as' clause as anything since nothing is returned?
This would not work and you've already pointed out why.
b> Ideally, I wouldn't hardcode the creates into my code but would use the
b>table names specified in the mapping files. Is there a way to get to
b>these names so I don't have to change mapping info in two places?
Usually, table creation is done either by hand or via an SQL
script. Seeing as how you want to create them every time the app is
executed and you want to do it via Java, I'd recommend the creation of
a separate class to handle all the table creation.
Bruce
--
perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev