db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Janssens Luc" <Janssens_Fris...@pandora.be>
Subject ejb and derby (2)
Date Sat, 03 Dec 2005 11:50:37 GMT
 

hallo,  second attempt (Satheesh,  thanks for your answer) 

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  

  Subject: Re: FW: ejb and derby

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.

Satheesh
 

Thank you, I did that: but I got internal call's from Derby (only useful
for the derby developpers I suppose):

Server is ready to accept connections on port 1527.

Connection number: 1.

----------------------------------------------------------------

2005-12-03 11:40:33.750 GMT:

Booting Derby version The Apache Software Foundation - Apache Derby -
10.1.2.1 - (330608): instance c013800d-0107-f06c-5045-fffff52e9fdf

on database directory X:\internetprogrammatie\data\derby\pag8 

Database Class Loader started - derby.database.classpath=''

2005-12-03 11:40:34.359 GMT Thread[DRDAConnThread_2,5,main] (XID =
1785), (SESSIONID = 0), (DATABASE = pag8), (DRDAID = {1}), Committing

2005-12-03 11:40:34.359 GMT Thread[DRDAConnThread_2,5,main] (XID =
1785), (SESSIONID = 0), (DATABASE = pag8), (DRDAID = {1}), Committing

2005-12-03 11:40:36.609 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Begin compiling prepared
statement: SELECT 1 FROM Person o WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.406 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), End compiling prepared statement:
SELECT 1 FROM Person o WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.625 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Executing prepared statement:
SELECT 1 FROM Person o WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.671 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Committing

2005-12-03 11:40:37.671 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Executing prepared statement:
SELECT 1 FROM Person o WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.671 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Committing

2005-12-03 11:40:37.687 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Begin compiling prepared
statement: SELECT ID FROM Person WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.687 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), End compiling prepared statement:
SELECT ID FROM Person WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.703 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Executing prepared statement:
SELECT ID FROM Person WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.703 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Committing

2005-12-03 11:40:37.703 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Begin compiling prepared
statement: SELECT lastname FROM Person WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.718 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), End compiling prepared statement:
SELECT lastname FROM Person WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.734 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Executing prepared statement:
SELECT lastname FROM Person WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.734 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Committing

2005-12-03 11:40:37.734 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Begin compiling prepared
statement: SELECT surname FROM Person WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.734 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), End compiling prepared statement:
SELECT surname FROM Person WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.750 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Executing prepared statement:
SELECT surname FROM Person WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.750 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Committing

2005-12-03 11:40:37.750 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Begin compiling prepared
statement: SELECT 1 FROM GEN_TABLE o WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.875 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Error compiling prepared
statement: SELECT 1 FROM GEN_TABLE o WHERE 1=0 :End prepared statement

2005-12-03 11:40:37.890 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Begin compiling prepared
statement: CREATE TABLE GEN_TABLE(

) :End prepared statement

2005-12-03 11:40:37.984 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Committing

2005-12-03 11:40:38.031 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Begin compiling prepared
statement: call SYSIBM.SQLCAMESSAGE(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
:End prepared statement

2005-12-03 11:40:38.109 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), End compiling prepared statement:
call SYSIBM.SQLCAMESSAGE(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) :End prepared
statement

2005-12-03 11:40:38.140 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}),   Executing prepared statement:
call SYSIBM.SQLCAMESSAGE(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) :End prepared
statement with 16 parameters begin parameter #1: -1 :end parameter begin
parameter #2: 41 :end parameter begin parameter #3: Encountered ")" at
line 2, column 142X01 :end parameter begin parameter #4: CSS10011 :end
parameter begin parameter #5: 0 :end parameter begin parameter #6: 0
:end parameter begin parameter #7: 0 :end parameter begin parameter #8:
0 :end parameter begin parameter #9: 0 :end parameter begin parameter
#10: 0 :end parameter begin parameter #11: :end parameter begin
parameter #12: 42X01 :end parameter begin parameter #13: null :end
parameter begin parameter #14: nl_BE :end parameter begin parameter #15:
null :end parameter begin parameter #16: null :end parameter 

2005-12-03 11:40:38.140 GMT Thread[DRDAConnThread_2,5,main] (XID =
1786), (SESSIONID = 0), (DATABASE = pag8), (DRDAID =
NF000001.G56A-666250136264089174{1}), Committing

 


Mime
View raw message