aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes JPA (TopLink) DB2 table generation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JPA (TopLink) DB2 table generation" Watch "JPA (TopLink) DB2 table generation" New topic
Author

JPA (TopLink) DB2 table generation

Morten Franorge
Ranch Hand

Joined: Jul 29, 2005
Posts: 137
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?


SCJP 1.4, SCBCD 1.3, SCBCD 5.0, SCEA J2EE, SCEA 5.0
Mike Keith
author
Ranch Hand

Joined: Jul 14, 2005
Posts: 304
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


-Mike
Pro JPA 2: Mastering the Java Persistence API
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Does your class have an Id mapping? Maybe that is what it was looking for and your object doesn't have one.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA (TopLink) DB2 table generation