• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JPA (TopLink) DB2 table generation

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
F is for finger. Can you stick your finger in your nose? Doesn't that feel nice? Now try this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic