Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java Entity class - MS Access Primary Key

Status
Not open for further replies.

pointertowhat

Programmer
Jan 13, 2009
22
US
I have a java entity class that is bound to a MS Access database using the persistance API.

The db has a table 'customers' with the primary key field set to autonumber. However, my entity bean does not update the pk correctly or at all (depends on what I set the GeneratedValue param to.

If I use
Code:
    @GeneratedValue(strategy=GenerationType.TABLE) 
    @Column(name = "CustomerId")
    public int getId() {
        return id;
    }
I get
Code:
Internal Exception: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot find the input table or query 'SEQUENCE'.  Make sure it exists and that its name is spelled correctly.
Error Code: -1305
Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
        bind => [50, SEQ_GEN_TABLE]

if I try
Code:
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
I get
Code:
[TopLink Info]: 2009.02.10 02:16:47.641--Not able to detect platform for vendor name [ACCESS]. Defaulting to [oracle.toplink.essentials.platform.database.DatabasePlatform]. The database dialect used may not match with the database you are using. Please explicitly provide a platform using property toplink.platform.class.name.

Does anyone know how to set up the persistance bean with ms access and an autonumber primary key field?
 
Gave up on this and switch to a Derby db - which is also giving problems of a different sort.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top