Difference between revisions of "EclipseLink/UserGuide/JPA/Advanced JPA Development/Schema Generation/Appending strings to CREATE TABLE statements"

From Eclipsepedia

Jump to: navigation, search
Line 16: Line 16:
 
>>>>>> THIS PAGE IS IN PROGRESS. PLEASE SEE DISCUSSION PAGE. <<<<<<
 
>>>>>> THIS PAGE IS IN PROGRESS. PLEASE SEE DISCUSSION PAGE. <<<<<<
  
As described below, you can append a string to the end of a CREATE TABLE statement when generating a DDL. Appending the string only affects the DDL generation. It does not affect any other runtime behavior.
 
  
Use the persistence unit property <tt>eclipselink.ddl-generation.table-creation-suffix</tt> to append a string the end of a CREATE TABLE statement.
+
You can append a string to the end of a CREATE TABLE statement when generating a DDL, as described below.  
  
 +
This can be useful, for example, to create tables that are transactional, by appending <tt>engine=InnoDB</tt> to the end of the CREATE TABLE statement. This specifies that the MySQL InnoDB storage engine will be used.
 +
 +
Appending the string only affects the DDL generation. It does not affect any other runtime behavior.
 +
 +
You can specify strings through persistence unit properties and through session properties that apply to all tables. You can also specify strings on individual tables.
 +
 +
Use the persistence unit property <tt>eclipselink.ddl-generation.table-creation-suffix</tt> to append a string, as shown in the example below.
  
  

Revision as of 10:22, 3 February 2011

EclipseLink JPA

link="http://wiki.eclipse.org/EclipseLink"
EclipseLink
Website
Download
Community
Mailing ListForumsIRC
Bugzilla
Open
Help Wanted
Bug Day
Contribute
Browse Source


Appending Strings to CREATE TABLE Statements

>>>>>> THIS PAGE IS IN PROGRESS. PLEASE SEE DISCUSSION PAGE. <<<<<<


You can append a string to the end of a CREATE TABLE statement when generating a DDL, as described below.

This can be useful, for example, to create tables that are transactional, by appending engine=InnoDB to the end of the CREATE TABLE statement. This specifies that the MySQL InnoDB storage engine will be used.

Appending the string only affects the DDL generation. It does not affect any other runtime behavior.

You can specify strings through persistence unit properties and through session properties that apply to all tables. You can also specify strings on individual tables.

Use the persistence unit property eclipselink.ddl-generation.table-creation-suffix to append a string, as shown in the example below.


Example

Assuming it has an ID annotated, an eclipselink-orm.xml file containing...

<entity class="Comment">
  <table name="DDL_COMMENT" creation-suffix="COMMENT='User Comment Table'"/>
</entity>

...results in the following creation statement:

  CREATE TABLE DDL_COMMENT (ID INTEGER) COMMENT='User Comment Table'

If it is coupled with the following persistence property...

<property name="eclipselink.ddl.default-table-suffix" value="engine=InnoDB"/>

it results in the following creation statement:

  CREATE TABLE DDL_COMMENT (ID INTEGER) COMMENT='User Comment Table' engine=InnoDB

Eclipselink-logo.gif
Version: 2.2.0 DRAFT
Other versions...