As an alternative:

I find it far easier to use DBUnit to export and import data in a
database-independent format.   If you use Eclipse, you can install the
QuantumDB plugin and export/import directly from eclipse (for small
tables).

Otherwise, it's trivial to write ant tasks to export and import data.

    <target name="export" description="Copies all global table data to
XML files" depends="">
                <dbunit
                        driver="oracle.jdbc.driver.OracleDriver"
                        classpath="${Oracle.lib}"
                        url="${jdbc.url}"
                        schema="schema"
                        userid="user"
                        password="password">

                <export dest="./data/dbunit/schema/TABLE1.xml" format="flat">
                        <query name="SCHEMA.TABLE1" sql="SELECT * FROM 
SCHEMA.TABLE1
ORDER BY ID"/>
                </export>                                               
                <export dest="./data/dbunit/schema/TABLE2.xml" format="flat">
                        <query name="SCHEMA.TABLE2" sql="SELECT * FROM 
SCHEMA.TABLE2
ORDER BY ID"/>
                </export>
                </dbunit>
    </target>


    <target name="import" description="Recreates global tables in
Oracle from XML files" depends="">
                <dbunit
                        driver="oracle.jdbc.driver.OracleDriver"
                        classpath="${Oracle.lib}"
                        url="${jdbc.url}"
                        schema="schema"
                        userid="user"
                        password="password">
            <operation type="CLEAN_INSERT"
src="./data/dbunit/schema/TABLE1.xml" "/>
            <operation type="CLEAN_INSERT"
src="./data/dbunit/schema/TABLE2.xml" "/>
                </dbunit>
    </target>

On Mon, Sep 7, 2009 at 5:07 AM, open.pumpkin<open.pump...@gmail.com> wrote:
> Hello,
>
> Is it possible to export tables using a dedicated cayenne function ?
>
> I would like to export one or more tables (and data), specified by the user
> of my application, to import them in another environment (for example from
> development to production).
>
> The ideal thing would be a SQL script generated by cayenne, independant of
> databases and cayenne (I could use it with Mysql query browser, for
> example).
>
> Else, using serialization of cayenne objects ?
> Or another possibility ?
>
> The interest is to not manually write SELECT and UPDATE statements.
>
> Thanx.
> O.P.
>

Reply via email to