vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi there, I use NetBeans 4.1EA and J2EE RI. I have no problem with creating CMP Entity beans using Pointbase or MySQL database server but when I want to deploy CMP Entity bean which is mapped to a PostgreSQL table, JCodeGenerator of Application server catches an Exception. Unfortunately, I could find only one message that it's sender have my problem and there was no reasonable reply to that. the message is: > Having a strange problem with Sun studio 4 update 1 talking to postgreSQL > 7.3. (Redhat version) > > Using the latest Postgres JDBC driver (both latest stable and dev > releases)- in Sun studio I'm having problems mapping my container manager > persitence entity beans to postgres tables. > > I make a database schema and entity bean from the postgres datasource > (everything's fine at this stage) but when I try to map > the ejb fields to tables in the postgres schema, for deployment, the > dialogue reports "Table 'x' has no primary keys defined" > > I've checked my keys and indexes and I definitley have a primary key > defined. Is there something I'm missing? > > I have the database in MySQL also and it works fine with Sun - but I'd > much > rather have a postgres backend. > > I've searched the web and newsgroups and can find hardly any information > on > this topic, your help would be very much appreciated > > > regards > Nuno D. Leitao and here is some information about my databse and app: 1. the database name is habib and is in localhost. 2. the table is student and here is it's columns: CREATE TABLE student ( id int2 NOT NULL, name varchar(10), CONSTRAINT student_pkey PRIMARY KEY (id) ) WITH OIDS; ALTER TABLE student OWNER TO habib; of course, I checked WITHOUT OIDS, but the problem remains. 3. here is public_Module1Ejb.dbschema : <?xml version="1.0" encoding="UTF-8" ?> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.SchemaEleme nt" ID="org.netbeans.modules.dbschema.SchemaElement-255648917"> <impl> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.jdbcimpl.Sc hemaElementImpl" ID="org.netbeans.modules.dbschema.jdbcimpl.SchemaE lementImpl1222210"> <tables> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.jdbcimpl.DB ElementsCollection" ID="org.netbeans.modules.dbschema.jdbcimpl.DBEleme ntsCollection7291167"> <owner> <OBJECT REFERENCE="org.netbeans.modules.dbschema.jdbcimpl. SchemaElementImpl1222210"/> </owner> <_elms> <ARRAY SIZE="1" CLASS="PRIMITIVE" ROWCLASS="com.sun.forte4j.modules.dbmodel.TableEle ment"> <ROW ROW="0"> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.TableElemen t" ID="org.netbeans.modules.dbschema.TableElement-393801032"> <impl> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.jdbcimpl.Ta bleElementImpl" ID="org.netbeans.modules.dbschema.jdbcimpl.TableEl ementImpl9164520"> <element> <OBJECT REFERENCE="org.netbeans.modules.dbschema.TableElem ent-393801032"/> </element> <table>student</table> <keys> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.jdbcimpl.DB ElementsCollection" ID="org.netbeans.modules.dbschema.jdbcimpl.DBEleme ntsCollection19377347"> <owner> <OBJECT REFERENCE="org.netbeans.modules.dbschema.jdbcimpl. TableElementImpl9164520"/> </owner> <_elms> <OBJECT/> </_elms> <_template> <ARRAY SIZE="0" CLASS="PRIMITIVE" ROWCLASS="com.sun.forte4j.modules.dbmodel.KeyEleme nt"> </ARRAY> </_template> </OBJECT> </keys> <_name> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.DBIdentifie r" ID="org.netbeans.modules.dbschema.DBIdentifier1541 1030"> <name>student</name> </OBJECT> </_name> <indexes> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.jdbcimpl.DB ElementsCollection" ID="org.netbeans.modules.dbschema.jdbcimpl.DBEleme ntsCollection16408207"> <owner> <OBJECT REFERENCE="org.netbeans.modules.dbschema.jdbcimpl. TableElementImpl9164520"/> </owner> <_elms> <ARRAY SIZE="1" CLASS="PRIMITIVE" ROWCLASS="com.sun.forte4j.modules.dbmodel.IndexEle ment"> <ROW ROW="0"> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.IndexElemen t" ID="org.netbeans.modules.dbschema.IndexElement8867 14089"> <impl> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.jdbcimpl.In dexElementImpl" ID="org.netbeans.modules.dbschema.jdbcimpl.IndexEl ementImpl23515932"> <element> <OBJECT REFERENCE="org.netbeans.modules.dbschema.IndexElem ent886714089"/> </element> <_unique>false</_unique> <_name> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.DBIdentifie r" ID="org.netbeans.modules.dbschema.DBIdentifier2072 3536"> <name>student_pkey</name> </OBJECT> </_name> <columns> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.jdbcimpl.DB ElementsCollection" ID="org.netbeans.modules.dbschema.jdbcimpl.DBEleme ntsCollection8628573"> <owner> <OBJECT REFERENCE="org.netbeans.modules.dbschema.jdbcimpl. TableElementImpl9164520"/> </owner> <_elms> <ARRAY SIZE="1" CLASS="PRIMITIVE" ROWCLASS="com.sun.forte4j.modules.dbmodel.ColumnEl ement"> <ROW ROW="0"> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.ColumnEleme nt" ID="org.netbeans.modules.dbschema.ColumnElement212 4155921"> <impl> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.jdbcimpl.Co lumnElementImpl" ID="org.netbeans.modules.dbschema.jdbcimpl.ColumnE lementImpl18430186"> <element> <OBJECT REFERENCE="org.netbeans.modules.dbschema.ColumnEle ment2124155921"/> </element> <_isNullable>false</_isNullable> <_length> <OBJECT CLASS="java.lang.Integer" ID="java.lang.Integer2"> <value>2</value> </OBJECT> </_length> <_name> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.DBIdentifie r" ID="org.netbeans.modules.dbschema.DBIdentifier1287 9730"> <name>id</name> </OBJECT> </_name> <_precision> <OBJECT REFERENCE="java.lang.Integer2"/> </_precision> <_type>5</_type> <_scale> <OBJECT CLASS="java.lang.Integer" ID="java.lang.Integer0"> <value>0</value> </OBJECT> </_scale> </OBJECT> </impl> <declaringTable> <OBJECT REFERENCE="org.netbeans.modules.dbschema.TableElem ent-393801032"/> </declaringTable> </OBJECT> </ROW> </ARRAY> </_elms> <_template> <ARRAY SIZE="0" CLASS="PRIMITIVE" ROWCLASS="com.sun.forte4j.modules.dbmodel.ColumnEl ement"> </ARRAY> </_template> </OBJECT> </columns> <tei> <OBJECT REFERENCE="org.netbeans.modules.dbschema.jdbcimpl. TableElementImpl9164520"/> </tei> </OBJECT> </impl> <declaringTable> <OBJECT REFERENCE="org.netbeans.modules.dbschema.TableElem ent-393801032"/> </declaringTable> </OBJECT> </ROW> </ARRAY> </_elms> <_template> <ARRAY SIZE="0" CLASS="PRIMITIVE" ROWCLASS="com.sun.forte4j.modules.dbmodel.IndexEle ment"> </ARRAY> </_template> </OBJECT> </indexes> <isTable>true</isTable> <columns> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.jdbcimpl.DB ElementsCollection" ID="org.netbeans.modules.dbschema.jdbcimpl.DBEleme ntsCollection7617295"> <owner> <OBJECT REFERENCE="org.netbeans.modules.dbschema.jdbcimpl. TableElementImpl9164520"/> </owner> <_elms> <ARRAY SIZE="2" CLASS="PRIMITIVE" ROWCLASS="com.sun.forte4j.modules.dbmodel.ColumnEl ement"> <ROW ROW="0"> <OBJECT REFERENCE="org.netbeans.modules.dbschema.ColumnEle ment2124155921"/> </ROW> <ROW ROW="1"> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.ColumnEleme nt" ID="org.netbeans.modules.dbschema.ColumnElement120 4524033"> <impl> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.jdbcimpl.Co lumnElementImpl" ID="org.netbeans.modules.dbschema.jdbcimpl.ColumnE lementImpl9988469"> <element> <OBJECT REFERENCE="org.netbeans.modules.dbschema.ColumnEle ment1204524033"/> </element> <_isNullable>true</_isNullable> <_length> <OBJECT CLASS="java.lang.Integer" ID="java.lang.Integer10"> <value>10</value> </OBJECT> </_length> <_name> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.DBIdentifie r" ID="org.netbeans.modules.dbschema.DBIdentifier3379 466"> <name>name</name> </OBJECT> </_name> <_precision> <OBJECT REFERENCE="java.lang.Integer10"/> </_precision> <_type>12</_type> <_scale> <OBJECT REFERENCE="java.lang.Integer0"/> </_scale> </OBJECT> </impl> <declaringTable> <OBJECT REFERENCE="org.netbeans.modules.dbschema.TableElem ent-393801032"/> </declaringTable> </OBJECT> </ROW> </ARRAY> </_elms> <_template> <ARRAY SIZE="0" CLASS="PRIMITIVE" ROWCLASS="com.sun.forte4j.modules.dbmodel.ColumnEl ement"> </ARRAY> </_template> </OBJECT> </columns> </OBJECT> </impl> </OBJECT> </ROW> </ARRAY> </_elms> <_template> <ARRAY SIZE="0" CLASS="PRIMITIVE" ROWCLASS="com.sun.forte4j.modules.dbmodel.TableEle ment"> </ARRAY> </_template> </OBJECT> </tables> <_name> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.DBIdentifie r" ID="org.netbeans.modules.dbschema.DBIdentifier2460 1638"> <name>habib [habib on public]</name> </OBJECT> </_name> <_driverVersion>PostgreSQL 7.4.5 JDBC3 with SSL (build 216)</_driverVersion> <_catalog> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.DBIdentifie r" ID="org.netbeans.modules.dbschema.DBIdentifier2202 5519"> <name>habib</name> </OBJECT> </_catalog> <element> <OBJECT REFERENCE="org.netbeans.modules.dbschema.SchemaEle ment-255648917"/> </element> <_databaseProductVersion>7.4.5</_databaseProductVersion> <_driver>org.postgresql.Driver</_driver> <_databaseProductName>PostgreSQL</_databaseProductName> <_schema> <OBJECT CLASS="com.sun.forte4j.modules.dbmodel.DBIdentifie r" ID="org.netbeans.modules.dbschema.DBIdentifier1041 7049"> <name>public</name> </OBJECT> </_schema> <_url>jdbc <_driverName>PostgreSQL Native Driver</_driverName> <_username>habib</_username> </OBJECT> </impl> <versionNo>2</versionNo> </OBJECT> 4. And finally here is sun-cmp-mappings.xml : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sun-cmp-mappings PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 OR Mapping//EN" "http://www.sun.com/software/appserver/dtds/sun-cmp-mapping_1_2.dtd"> <sun-cmp-mappings> <sun-cmp-mapping> <schema>public_Module1Ejb</schema> <entity-mapping> <ejb-name>Student</ejb-name> <table-name>student</table-name> <cmp-field-mapping> <field-name>id</field-name> <column-name>student.id</column-name> <fetched-with> <default/> </fetched-with> </cmp-field-mapping> <cmp-field-mapping> <field-name>name</field-name> <column-name>student.name</column-name> <fetched-with> <default/> </fetched-with> </cmp-field-mapping> </entity-mapping> </sun-cmp-mapping> </sun-cmp-mappings> Please help me, Thank you in advance, Habib ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster |