Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Foreign key constraint with create_or_extend_table is used(Foreign key constraint recreated when create_or_extend_table is used)
icon13.gif  Foreign key constraint with create_or_extend_table is used [message #1053679] Tue, 07 May 2013 04:35 Go to next message
Panisha RN is currently offline Panisha RN
Messages: 17
Registered: May 2013
Junior Member
Foreign key constraint re-created when create_or_extend_table is used.

On running my application which is using the existing database eclipse link is trying to create the foreign key constraint again and fails with the error message.

Internal Exception: java.sql.SQLException: Can't create table '.\<Database Name>\#sql-a4_151.frm' (errno: 121)

I am using Eclipse link 2.4.0.

Can any one help me how to avoid re-creation is foreign key constraint.

Thanks in advance.
Re: Foreign key constraint with create_or_extend_table is used [message #1053767 is a reply to message #1053679] Tue, 07 May 2013 10:22 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 995
Registered: July 2009
Senior Member
Is this causing a failure? EclipseLink should try to create all constraints, but any exceptions should just be logged and not prevent the app from running.

Best Regards
Chris
Re: Foreign key constraint with create_or_extend_table is used [message #1057786 is a reply to message #1053767] Wed, 08 May 2013 13:48 Go to previous messageGo to next message
Panisha RN is currently offline Panisha RN
Messages: 17
Registered: May 2013
Junior Member
Hello Delahunt,

First of all thank you so much for your reply.

Eclipse link not causing the failure, but why does it trying to create the constaint which is alreday exist.

In my case i am using existing table where in all the constraits are already applied to all the table and eclipse link trying to create it agian when create_or_extend ddl generation option is used.

I was using Hibernate earlier with "update" option there was no issue with that.

Why Eclipse link trying to create the constraint which is already exist?

Is it a bug in Eclipse link 2.4.0

Please help me to clarify my doubt.
Re: Foreign key constraint with create_or_extend_table is used [message #1057791 is a reply to message #1057786] Wed, 08 May 2013 14:52 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 995
Registered: July 2009
Senior Member
EclipseLink issues the create constraint statement rather than checking if each constraint exists and then issuing a create statement if it isn't. It then logs the error it encounters if it cannot create the constraint, I believe at the warning level. These messages can be ignored, and if you don't want to see the messages logged, set logging to a lower level than warning.

Best Regards,
Chris
Previous Topic:create a function via nativeQuery
Next Topic:create_or_extend_Tables ddl generation issue
Goto Forum:
  


Current Time: Sun Apr 20 12:35:06 EDT 2014

Powered by FUDForum. Page generated in 0.02489 seconds