Unwanted PK problem!

Tim Cockle <[email protected]> Fri, 02 Sep 2005 12:28:32 +0100
Newsgroups gmane.comp.java.ejb.middlegen.user
Message-ID <1125660512.1254.590.camel@localhost>
Hi,

I hope someone out there can help as I am stuck on this one! I have a
set of tables, form, part and question. The logic is that forms are a
collection of parts and parts are a collection of questions. 

The database I am using is postgresql and the tables are created with
the following SQL (I have removed some details for clarity).

CREATE TABLE form(
	"form_id" INT NOT NULL,
	"form_name" VARCHAR(255) NOT NULL,
	?
	PRIMARY KEY("form_id")
) ;

CREATE TABLE part(
	"part_id" INT NOT NULL,
	"part_name" VARCHAR(255) NOT NULL,
	?
	"form_id_fk" INT,
	PRIMARY KEY("part_id"),
    FOREIGN KEY ("form_id_fk") REFERENCES "form"("form_id")
);

CREATE TABLE question(
	"question_id" INT NOT NULL,
	"question_text" VARCHAR(255) NOT NULL,
	? 
	"part_id_fk" INT,
	"form_id_fk" INT,
	PRIMARY KEY("question_id"),
    FOREIGN KEY ("part_id_fk") REFERENCES "part"("part_id"),
	FOREIGN KEY ("form_id_fk") REFERENCES "form"("form_id")
);

The middlegen tag in ant is as follows:

<middlegen
       appname="${name}"
       prefsdir="${src.dir}"
       gui="${gui}"
       databaseurl="${database.url}"
       initialContextFactory="${java.naming.factory.initial}"
       providerURL="${java.naming.provider.url}"
       datasourceJNDIName="${databaseSource}"
       driver="${database.driver}"
       username="${database.userid}"
       password="${database.password}"
       schema=""
      >


       	<table name="question"/>
       	<table name="part"/>
       	<table name="form"/> 

         <cmp20
            destination="${src.gen-code.dir}"
            package="alpha.formEntities"
            interfacepackage="alpha.formEntitiesInterfaces"
            jndiprefix="${unique.name}"
            pkclass="false"
            dataobject="false"
            viewtype="local"
            mergedir="${basedir}/src/middlegen"
            readonly="false"
            fkcmp="false" 
            guid="true"
         >
         	<finders>
         		<and>
         			<pk/>
         			<not>
         	        	<fk/>
         			</not>
         			<not>
         				<notkey/>
         	    	</not>
         		</and>
         	</finders>
         	
           <sequenceblock
               blocksize="5"
               retrycount="2"
               table="SEQ_BLOCK"
               package="alpha.miscEntities"
               interfacepackage="alpha.miscEntitiesInterfaces"
           />

            <jboss/>
         </cmp20>
      </middlegen>

The problem is this, form and question both an Integer as the primary
key however part uses a PartPK class even though cmp20 has
pkclass="false" set.

HeLp!!!!

Thanks,

Tim




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf