hallo,

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

A little example:

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

@Entity
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.

web.xml:

<web-app>

<database>
   <jndi-name>jdbc/pgsql</jndi-name>
   <driver>
       <type>org.apache.derby.jdbc.ClientDriver</type>
       <url>jdbc:derby://localhost:1527/pag8;create=true;user=APP;password=APP;
</url>
       <user>APP</user>
       <password>APP</password>
    </driver>
</database>

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

Who can give a hint? Thanks 

 

Luc