db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@Sourcery.Org>
Subject Re: FW: ejb and derby
Date Thu, 01 Dec 2005 21:18:55 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
If you can run with Derby property, <b>derby.language.logStatementText=true</b>,
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.<br>
<br>
Satheesh<br>
<br>
Janssens Luc wrote:<br>
<blockquote cite="mid006a01c5f6b4$55d907c0$0400a8c0@zolder" type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <title>Message</title>
  <meta content="MSHTML 6.00.2900.2769" name="GENERATOR">
  <div>
  <font face="Arial" size="2">hallo,</font></div>
  <div>
  <p><font face="Arial" size="2">I am an instructor who tries out Derby
with ejb (and jsf).</font></p>
  <p><font face="Arial" size="2">A little example:</font></p>
  <blockquote style="margin-right: 0px;" dir="ltr">
    <p><font face="Arial" size="2">package be.timvw.model;<br>
    </font><font face="Arial" size="2">import javax.ejb.*;</font></p>
    <p><strong><font face="Arial" size="2">@Entity<br>
    </font></strong><font face="Arial" size="2">public class Person {<br>
    <span class="507360820-01122005">&nbsp;&nbsp; </span>private int personId;<br>
    <span class="507360820-01122005">&nbsp;&nbsp; </span>private String
lastname;<br>
    <span class="507360820-01122005">&nbsp;&nbsp; </span>private String
surname;<br>
public Person() {lastname = surname = "";}</font></p>
    <p><font face="Arial"><font size="2"><strong>@Id(generate =
GeneratorType.AUTO)//</strong> GeneratorType.AUTO gives problems with
Derby<br>
public int getPersonId() {return personId;}<br>
public void setPersonId(int personId) {this.personId = personId;}</font></font></p>
    <p><font face="Arial" size="2">public String getLastname() {return
lastname;}<br>
public void setLastname(String lastname) {this.lastname = lastname;}</font></p>
    <p><font face="Arial" size="2">public String getSurname() {return
surname;}<br>
public void setSurname(String surname) {this.surname = surname; }</font><font
 face="Arial" size="2">}</font></p>
  </blockquote>
  <p><font face="Arial" size="2">I get the following error: </font></p>
  <blockquote style="margin-right: 0px;" dir="ltr">
    <p><font face="Arial" size="2"><strong>org.apache.derby.client.am.SqlException:
Syntax error: Encountered ")" at line 2, column 1.</strong></font></p>
  </blockquote>
  <p><font face="Arial"><font size="2">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 :<span class="507360820-01122005">&nbsp; </span></font></font><font
 face="Arial" size="2">CREATE TABLE foo (ID INT NOT NULL PRIMARY KEY
GENERATED ALWAYS AS IDENTITY, .....)</font></p>
  <p><font face="Arial"><font size="2">I'm working with Resin 3.0.14<span
 class="507360820-01122005">, latest version of derby.</span></font></font></p>
  <p><font face="Arial" size="2">web.xml:</font></p>
  <blockquote style="margin-right: 0px;" dir="ltr">
    <p><font face="Arial" size="2">&lt;web-app&gt;</font></p>
    <p><font face="Arial" size="2">&lt;database&gt;<br>
    </font><font face="Arial"><font size="2"><span
 class="507360820-01122005">&nbsp;&nbsp; </span>&lt;jndi-name&gt;jdbc/pgsql&lt;/jndi-name&gt;<br>
    </font></font><font face="Arial"><font size="2"><span
 class="507360820-01122005">&nbsp;&nbsp; </span>&lt;driver&gt;<br>
    </font></font><font face="Arial"><font size="2"><span
 class="507360820-01122005">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>&lt;type&gt;org.apache.derby.jdbc.ClientDriver&lt;/type&gt;<br>
    <span class="507360820-01122005">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&lt;url&gt;jdbc:derby://localhost:1527/pag8;create=true;user=APP;password=APP;</font></font><font
 face="Arial" size="2">&lt;/url&gt;<br>
    </font><font face="Arial"><font size="2"><span
 class="507360820-01122005">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&lt;user&gt;APP&lt;/user&gt;<br>
    </font></font><font face="Arial"><font size="2"><span
 class="507360820-01122005">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>&lt;password&gt;APP&lt;/password&gt;<br>
    </font></font><font face="Arial"><font size="2"><span
 class="507360820-01122005">&nbsp;&nbsp;&nbsp; </span>&lt;/driver&gt;<br>
&lt;/database&gt;</font></font></p>
    <p><font face="Arial" size="2">&lt;ejb-server
data-source="jdbc/pgsql" <strong>create-database-schema="true"</strong>&gt;<br>
    <span class="507360820-01122005">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>&lt;bean
type="be.timvw.model.Person"/&gt; <br>
&lt;/ejb-server&gt; ....</font></p>
  </blockquote>
  <p><font face="Arial"><font size="2">Who can give a hint? Thanks<span
 class="320351720-01122005"><font color="#0000ff">&nbsp;</font></span></font></font></p>
  <p><font face="Arial"><font size="2"><span class="320351720-01122005"></span></font></font>&nbsp;</p>
  <p><font face="Arial"><font size="2"><span class="320351720-01122005"><font
 color="#0000ff">Luc </font>&nbsp;</span></font></font></p>
  </div>
</blockquote>
</body>
</html>


Mime
View raw message