You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Keqiang Feng <fe...@gmail.com> on 2007/08/30 08:10:56 UTC

Question:openJpa.How can I automatic generate table using openjpa?

When I use toplink,I put "<property name="toplink.ddl-generation"
value="create-tables"/>" into persistence.xml.Then i don't need create table
in database by my hand.I just write a java bean and r/w it from
database.Ifit's not existed of the table,toplink will create it.

I can't find it in openjpa.If you have this function,please tell me.I think
it's very useful function.

Thank you!

Re: Question:openJpa.How can I automatic generate table using openjpa?

Posted by "f.keqiang" <fe...@gmail.com>.
Thanks.
-- 
View this message in context: http://www.nabble.com/Question%3AopenJpa.How-can-I-automatic-generate-table-using-openjpa--tf4352146.html#a12419116
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Re: Question:openJpa.How can I automatic generate table using openjpa?

Posted by Patrick Linskey <pl...@gmail.com>.
Hi,

You can do something similar like so in OpenJPA:

    <property name="openjpa.SynchronizeMappings" value="buildSchema"/>

Personally, for unit testing, I prefer the following:

    <property name="openjpa.SynchronizeMappings"
        value="buildSchema(SchemaAction=add,deleteTableContents)"/>

That will update the schema with any new elements, and will issue
unqualified delete statements against all the tables that OpenJPA
knows about. For tables with a small number of records in them, this
is usually the fastest way to get a clean schema.

-Patrick

On 8/29/07, Keqiang Feng <fe...@gmail.com> wrote:
> When I use toplink,I put "<property name="toplink.ddl-generation"
> value="create-tables"/>" into persistence.xml.Then i don't need create table
> in database by my hand.I just write a java bean and r/w it from
> database.Ifit's not existed of the table,toplink will create it.
>
> I can't find it in openjpa.If you have this function,please tell me.I think
> it's very useful function.
>
> Thank you!
>


-- 
Patrick Linskey
202 669 5907