CMP Entity bean and Primary key

Поиск
Список
Период
Сортировка
Искать

CMP Entity bean and Primary key

От:
Habib Seifzadeh <habibseifzadeh@yahoo.com>
Дата:
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 :



   
     
       
         
           
             
           
           <_elms>
             
               
                 
                   
                     
                       
                         
                       
                       student
<_elms> <_template> <_name> student <_elms> <_unique>false <_name> student_pkey <_elms> <_isNullable>false <_length> 2 <_name> id <_precision> <_type>5 <_scale> 0 <_template> <_template> true <_elms> <_isNullable>true <_length> 10 <_name> name <_precision> <_type>12 <_scale> <_template> <_template> <_name> habib [habib on public] <_driverVersion>PostgreSQL 7.4.5 JDBC3 with SSL (build 216) <_catalog> habib <_databaseProductVersion>7.4.5 <_driver>org.postgresql.Driver <_databaseProductName>PostgreSQL <_schema> public <_url>jdbc:postgresql://localhost:5432/habib <_driverName>PostgreSQL Native Driver <_username>habib 2 4. And finally here is sun-cmp-mappings.xml : public_Module1Ejb Student student id student.id name student.name Please help me, Thank you in advance, Habib
FAQ