This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

JPA (TopLink) DB2 table generation  RSS feed

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When I use mye JPA Entities to generate tables in DB2, I get an error "-540". This error occurs because:

"THE DEFINITION OF TABLE <table name> IS INCOMPLETE BECAUSE IT LACKS A PRIMARY INDEX OR A REQUIRED UNIQUE INDEX"

The work around has been to create a unique index after the table is created:
CREATE UNIQUE INDEX tablename_PKEY
ON tablename
(
ID asc
)

When I've done this, I get another strange error stating that the index parameter is out of range, when calling entityManager.find(1, EntityClass.class)

I'm not sure whether it's a problem with TopLink's way of executing DDLs on db2 or what. Maybe there is a trick to get this working?
 
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Morten,

I know that one of the DB's they test with is Derby, which is similar to DB2 but I don't know if there are any issues with ddl gen on DB2 specifically. You might get a better response on the Glassfish forum. You can talk to the developers, there, and see if there is any existing known issue in the issue tracker.

-Mike
 
ranger
Sheriff
Posts: 17314
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your class have an Id mapping? Maybe that is what it was looking for and your object doesn't have one.

Mark
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!