geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Mulder <ammul...@alumni.princeton.edu>
Subject Re: PetStore 1.3.2 goes to sandbox
Date Sat, 09 Jul 2005 19:00:09 GMT
I think I misled you on the key generator configuration, as I didn't
correctly understand the auto-increment generator features.  The current
problem (no such entity) is caused because the auto-increment-table key
generator actually assumes you'll be writing a row to the entity table,
but that's not what's being done in the current Pet Store configuration.  
Here's the relavant DDL right now:

CREATE TABLE SEQUENCE_TABLE
(
  ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, 
INCREMENT BY 1), 
  DUMMY INT
);

CREATE TABLE ADDRESSES
(
  ID INT NOT NULL, 
  ZIPCODE VARCHAR(255),
  STATE VARCHAR(255),
  STREETNAME2 VARCHAR(255),
  STREETNAME1 VARCHAR(255),
  COUNTRY VARCHAR(255),
  CITY VARCHAR(255)
);

	Contrary to what any documentation might have said previously, I 
don't think that will work with our key generators.  There are two ways to 
get it to work:

-- Option 1 --

CREATE TABLE ADDRESSES
(
  ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, 
INCREMENT BY 1), 
  ZIPCODE VARCHAR(255),
  ...
);

      <key-generator xmlns="http://www.openejb.org/xml/ns/pkgen">
        <auto-increment-table>
          <sql>insert into addresses (ZIPCODE) values (null)</sql>
          <return-type>java.lang.Integer</return-type>
        </auto-increment-table>
      </key-generator>

-- Option 2 --

CREATE TABLE PETSTORE_SEQUENCE (
  NAME VARCHAR(30) NOT NULL,
  VALUE INTEGER NOT NULL
);
CREATE TABLE ADDRESSES (...);
INSERT INTO PETSTORE_SEQUENCE VALUES ('ADDRESSES',1);

      <key-generator xmlns="http://www.openejb.org/xml/ns/pkgen">
        <sequence-table>
          <table-name>PETSTORE_SEQUENCE</table-name>
          <sequence-name>ADDRESSES</sequence-name>
          <batch-size>1</batch-size>
        </sequence-table>
      </key-generator>

Thanks,
	Aaron

On Sat, 9 Jul 2005, Jacek Laskowski wrote:
> Hi,
> 
> Being tired to work on it alone without any clues as to why it keeps 
> failing I decided to create a mavenized project that helps configuring, 
> deploying and starting/stoping PetStore configuration. It's the best way 
> to share its configuration to you all I could think of. I think it is a 
> way to engage others to work on it, together.
> 
> So, check out Geronimo revision 209954, read 
> http://wiki.apache.org/geronimo/PetStore and let me know how to proceed.
> 
> Jacek
> 
> 
> 

Mime
View raw message