Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » JPA Generate Entities From Tables Fails(JPA Generate Entities From Tables Fails on Foreign Keys)
JPA Generate Entities From Tables Fails [message #1404153] Wed, 30 July 2014 05:26 Go to next message
Brad OHearne is currently offline Brad OHearneFriend
Messages: 3
Registered: July 2014
Junior Member
I am trying to generate entities from tables on a SQL Server database. Whenever I try to generate these entities, every table with a foreign key fails to generate an entity (though there is a reference to that entity in the persistence.xml, which then results in an error).

The error which I'm receiving on all the entities which fail to generate (and there are quite a few across the schema which fail) are as follows (with varying table and foreign key names):

org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getImportStatements' in class org.eclipse.jpt.jpa.gen.internal.ORMGenTable threw exception java.lang.IllegalStateException: MyTable1.FK_MyTable1_MyTable2 - mismatched sizes: 0 vs. 1 @ main.java.vm[7,9]

I have gone through the "Generate Entities from Tables" wizard about 20 times, and there doesn't seem to be any configurable option which can affect this, nor hint of any error in the wizard. There appears to be no way for me to affect this.

I have done my share of Googling of this problem, and found a few references to a similar (possibly the same) issue going back to 2008 -- a bug in the Dali tools related to SQL Server. I would hope that 6 years would be enough time to possibly rectify the problem, but it appears as of a year ago, it still hadn't been fixed.

Does anyone know a way around this? Is there a fix or a workaround? Without getting past this problem, JPA projects and the JPA plugin on Eclipse is utterly useless for use with SQL Server.

Any help is appreciated.

Thanks,

Brad
Re: JPA Generate Entities From Tables Fails [message #1404215 is a reply to message #1404153] Wed, 30 July 2014 13:50 Go to previous messageGo to next message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
I think the bug you are referring to is this one - https://bugs.eclipse.org/bugs/show_bug.cgi?id=282206 which just to clarify is a "Data Tools" bug, which is a separate Eclipse project, not that this really changes anything for you, the end user.

Not sure if this will be helpful but sometimes it helps isolate the issue. Can you open the Data Explorer and traverse down to the tables in question, looking at the columns/constraints. Does everything look correct there? Do you see the FK's listed, etc?

Also, are you using a pure Kepler install or is it a commercial installed Eclipse?

Neil
Re: JPA Generate Entities From Tables Fails [message #1404245 is a reply to message #1404215] Wed, 30 July 2014 15:35 Go to previous message
Brad OHearne is currently offline Brad OHearneFriend
Messages: 3
Registered: July 2014
Junior Member
Neil,

Thanks for the reply. Yeah, the bug you mentioned is indeed the bug -- you might have noticed the most recent post on the bug is from me. To your questions:

- When going through the "Generate Entities from Tables" wizard, it appears to detect all of the relationships between tables properly, and the detail when I click on these relationships shows the proper fields are linked. But the generation of the entities themselves when the wizard is finished still fails.

- I am using a base (pure) install of Kepler. Eclipse was not installed as a part of any other commercial product install.

Here's one more nugget of information. If I try to generate only a single entity (rather than multiple entities) on one of these tables that fails when generating the entire collection of tables, when I go to the wizard dialog that shows relationships, there are none (because there's only a single table in play), but however, the entity generation STILL fails with the same error. In other words, there is no way to generate an entity on these tables with foreign keys.

Strange....

Brad
Previous Topic:"Generate entities from tables" with common attributes
Next Topic:Generate Entities from Tables - Skips One Table
Goto Forum:
  


Current Time: Tue Mar 19 02:37:04 GMT 2024

Powered by FUDForum. Page generated in 0.03202 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top