Return-Path: Delivered-To: apmail-incubator-empire-db-user-archive@minotaur.apache.org Received: (qmail 33993 invoked from network); 17 Feb 2010 21:45:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Feb 2010 21:45:23 -0000 Received: (qmail 36859 invoked by uid 500); 17 Feb 2010 21:45:23 -0000 Delivered-To: apmail-incubator-empire-db-user-archive@incubator.apache.org Received: (qmail 36780 invoked by uid 500); 17 Feb 2010 21:45:22 -0000 Mailing-List: contact empire-db-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: empire-db-user@incubator.apache.org Delivered-To: mailing list empire-db-user@incubator.apache.org Received: (qmail 36759 invoked by uid 99); 17 Feb 2010 21:45:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Feb 2010 21:45:22 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [88.79.172.157] (HELO mail.esteam.de) (88.79.172.157) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Feb 2010 21:45:14 +0000 Content-class: urn:content-classes:message Subject: re: Spring example MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Wed, 17 Feb 2010 22:44:31 +0100 Message-ID: X-MimeOLE: Produced By Microsoft Exchange V6.5 In-Reply-To: <4B78271E.30905@eknet.org> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: re: Spring example thread-index: AcqtlA6VU7N7Kux0SmOHIDvGscI/fQCg+oUA References: <4B74867E.8010808@eknet.org> <4B78271E.30905@eknet.org> From: =?iso-8859-1?Q?Rainer_D=F6bele?= To: Cc: X-Virus-Checked: Checked by ClamAV on apache.org Hi Eike, finally I had the chance to look at your spring example and I think it = is pretty cool. Thank you very much for providing this example - great work! I am sure it will be a good guide for many users who wish to use = Empire-db with Spring. In order to simplify it a bit I have removed the dependency to the basic = example project and copied the database definition and sample bean over. = I think this example is ready for distribution with our upcoming = release. Regards Rainer Eike Kettner wrote: > Re: how to add a "foreign" table >=20 > Hi Rainer >=20 > thank you for your quick response; and you're very welcome with this > spring example, I'm glad if can help. >=20 > My final goal was to create some kind of migration script to upgrade = my > db schema, because my app will contain some new features in next > versions which will add tables and columns to the existing db schema. = I > want to compare two instances of DBDatabase and generate the sql ddl > statements. So actually, I don't really need to add the table to the > other db, but I want to create arbitary sql ddl statements (for > DBTable, > DBColumn, DBView...) using a different driver. This works with > DBDatabse > already, I can specify a DBDatabaseDriver there and the method will > change the driver temporarily. Therefor I tried to either add the > missing table from the one db to the other or to set the > DBDatabaseDriver of the first db into the second, so I can use the > second DB to create its table - but now with the driver from the first > db... >=20 > I somehow got an evil workaround by serializing the two DBDatabses and > while deserializing back, I inject my desired driver into the > DBDatabases. So I end up with a clone of the db having my target = driver > attached. >=20 > Thank you four your help! > Eike >=20 > Rainer D=F6bele wrote: > > Hi Eike, > > > > first I want to thank you very much for your submission of the = spring > example. > > Unfortunately I did not have the chance to look at it so far - but I > am quite keen to do so. > > I'll let you know when I have. > > > > Now about your question: > > A DBTable object may only belong to one database object just like an > XMLElement belongs to its XMLDocument. > > This assignment is usually performed on creation of the DBTable and > there is no mechanism to change it. > > > > Hence if you really need to need a copy of the table object of one > database in another one you need to create a new instance of the table > object. > > Normally you would just create a instalce of the table like this: > > > > DBTable t =3D new DB1.SomeTable(db2); > > > > If your code should be more generic then you might use something > like: > > > > DBTable t =3D db1.getTable(...); > > t.getClass().getConstructor(DBDatabase.class).newInstance(new > Object[] { db2 }); > > > > This assumes that the table has a constructor that takes the db as a > parameter. > > > > Hope this is what you need. > > Otherwiese I would need to know what excatly you are trying to > achieve with this. > > > > Regards > > Rainer > > > > > > Eike Kettner wrote: > > > >> re: how to add a "foreign" table > >> > >> Hello all, > >> > >> I'm facing a problem that I want to add a table from one db to > another > >> db. I have two DBDatabases and I like to add a table from DB1 to > DB2, > >> something like this: > >> > >> > >> DBDatabase db1 =3D .. > >> DBDatabase db2 =3D .. > >> > >> DBTable table1 =3D db1.getTable(0); > >> > >> db2.addTable(table1); > >> > >> > >> actually, what i want is to create a table on DB2 that is present = on > >> DB1, without too much coding ;-) > >> > >> Thankful for any help! > >> > >> Kind regards, > >> Eike > >> > > > >