Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316563

Summary: Fix for the creation of DDL for Index
Product: z_Archived Reporter: zhao jianyong <zjy.net>
Component: EclipselinkAssignee: Project Inbox <eclipselink.foundation-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: abdullahn, dieskun, peter.krogh, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: submitted_patch
Attachments:
Description Flags
Fix for the creation of DDL for Index
none
Better way for creation and deletion of Index
none
Amalgamated Patch peter.krogh: iplog+

Description zhao jianyong CLA 2010-06-10 21:35:01 EDT
Build Identifier: 

I attached two patches in Bug 288715 to fix the bugs in the creation of Index.
But bug 288715 is closed and may not get any attention. 
To get more attention ,this bug is opened.

Reproducible: Always
Comment 1 zhao jianyong CLA 2010-06-10 21:37:55 EDT
Created attachment 171686 [details]
Fix for the creation of DDL for Index

There is a simple bug in the creation of DDL for Index.
With the bug some DDLs would be missed in the DDL file.
Comment 2 zhao jianyong CLA 2010-06-10 21:42:58 EDT
Created attachment 171687 [details]
Better way for creation and deletion of Index
Comment 3 zhao jianyong CLA 2010-06-10 22:52:57 EDT
For Symfoware all indexs should be deleted before "drop table <tableName>". While elements which are created by the old programme are dropped by the new one. It may cause some indexs would not be dropped before dropping table.

So I think "drop table <tableName> cascade" may be a better way to drop table than "drop table <tableName>". 
Because with "cascade", even the indexs are not be dropped before, the table could be dropped prettily.
Comment 4 Tom Ware CLA 2010-06-15 09:00:37 EDT
The patch seems incomplete.  Do you have code that actually writes the SQL for cascade?  (An updated SymfowarePlatform or other DatabasePlatform, for instance)

Is the issue you are seeing due to a bug in EclipseLink, or is it because the schema has changed between the initial schema creation and the time it is dropped?

I think an enhancement like this should be enabled by a property/some API, and not enabled by default.
Comment 5 zhao jianyong CLA 2010-06-15 10:41:47 EDT
(In reply to comment #4)
> The patch seems incomplete.  Do you have code that actually writes the SQL for
> cascade?  (An updated SymfowarePlatform or other DatabasePlatform, for
> instance)
My patches do not include the fix for "cascade".

I am sorry, but actually I don't know how other databases support for "cascade".
So it's hard for me to attach a patch for "cascade".
Comment 6 Tom Ware CLA 2010-06-15 10:54:25 EDT
Can you provide some details of what the symptoms of the bug you are fixing are?
Comment 7 Tom Ware CLA 2010-06-15 11:13:01 EDT
Setting target and priority.  See the following page for details of the meanings of these:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Note bugs with submitted_patches and/or multiple votes will get revisited from time to time and can potentially jump the queue.
Comment 8 zhao jianyong CLA 2010-06-15 11:43:26 EDT
(In reply to comment #6)
> Can you provide some details of what the symptoms of the bug you are fixing
> are?
Details of "cascade"?

The "cascade" issue actually is not a bug, but an enhancement. Without
"cascade", it seems that there also is no problem.

In Symfoware's manual, it is said that all indexs of a table should be dropped
before dropping the table without "cascade". But now the sql created for
dropping index may miss something.

Like this:
[1] I am creating a JPA program. The program has a Entity "Person", the
attribute named "name" of which is unique.
[2] Test it in SE with "drop and create".
[3] I remove the unique for "name", because I find men with the same name are
possible.
[4] Test it again.

The index created in [2] for "name" do not be dropped in [4] before dropping
table, because "name" is not unique in [4].
Comment 9 Tom Ware CLA 2010-06-15 11:58:59 EDT
FYI: GlassFish deals with this issue by using our sql-script ddl-generation option and saves the file with the drop statements in it.  It then executes the saved file when the persistence unit is redeployed.

How does the behavior change with your patch?
Comment 10 zhao jianyong CLA 2010-06-15 12:31:16 EDT
(In reply to comment #9)
> How does the behavior change with your patch?
My pathes do nothing for "cascade". (see  Comment 5)

My first attachment (id=171686) is to fix a bug. With the bug, some SQLs for creating indexs would not be writted into the DDL file.

My second attachment (id=171687) is not a fix, just an enhancement. It makes the code for creation and deletion of indexs more clear and understandable.
Comment 11 Tom Ware CLA 2010-06-17 10:17:41 EDT
Created attachment 172124 [details]
Amalgamated Patch
Comment 12 Tom Ware CLA 2010-06-17 10:20:33 EDT
Added both patches.

Tested Index issue by manually inspecting the ddl.

Tested both patches with Core and JPA LRG

Reviewed by: Tom Ware - reviewed community supported fix

Setting target to 2.1.1 and priority to P1 so fix will be migrated to 2.1.1 when the stream opens
Comment 13 Peter Krogh CLA 2010-07-22 13:02:35 EDT
I am not porting this to 2.1.1.  The changes to interface and the dropping of methods is concerning in a patch release.

Fine for trunk.  (2.2.0)
Comment 14 Peter Krogh CLA 2010-12-06 09:49:40 EST
fixing ipLog flag
Comment 15 Eclipse Webmaster CLA 2022-06-09 10:06:20 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink