If you can run with Derby property, derby.language.logStatementText=true, it would show the SQL statement that is getting generated. I suspect that may have a syntax error. You just need to have that one line (added) to your derby.properties file.


Janssens Luc wrote:

I am an instructor who tries out Derby with ejb (and jsf).

A little example:

package be.timvw.model;
import javax.ejb.*;

public class Person {
   private int personId;
   private String lastname;
   private String surname;
public Person() {lastname = surname = "";}

@Id(generate = GeneratorType.AUTO)// GeneratorType.AUTO gives problems with Derby
public int getPersonId() {return personId;}
public void setPersonId(int personId) {this.personId = personId;}

public String getLastname() {return lastname;}
public void setLastname(String lastname) {this.lastname = lastname;}

public String getSurname() {return surname;}
public void setSurname(String surname) {this.surname = surname; }

I get the following error:

org.apache.derby.client.am.SqlException: Syntax error: Encountered ")" at line 2, column 1.

If I delete "(generate = GeneratorType.AUTO)", I don't get this error. I tried other GeneratorType.IDENTITY : not supported by Derby. Derby has a sort of 'auto_increment' like mysql :  CREATE TABLE foo (ID INT NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY, .....)

I'm working with Resin 3.0.14, latest version of derby.




<ejb-server data-source="jdbc/pgsql" create-database-schema="true">
               <bean type="be.timvw.model.Person"/>
</ejb-server> ....

Who can give a hint? Thanks