0 Replies Latest reply on Mar 15, 2007 5:42 AM by idylle test

    bpchar conversion with PostgreSQL

    idylle test Newbie

      Hi,

      I've got a problem when reverse-engineering my PostgreSQL base with seam 1.2.0PATCH1.
      Entity beans are well generated but when I restart my server I got the following error :

      --- MBeans waiting for other MBeans ---
      ObjectName: persistence.units:ear=bourseEmploi.ear,unitName=bourseEmploi
       State: FAILED
       Reason: javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: agtdna, expected: varchar(10)
       I Depend On:
       jboss.jca:service=DataSourceBinding,name=bourseEmploiDatasource
      


      It appears on all database fields that are of type character(X) where X is more than 1. No problem with varchar(X) types.

      I've found a work around : for each field of that type, I modify manually the Column definition in the entity bean file :
      Generated code is :
      @Column(name = "agtdna", nullable = false, length = 10)
       @NotNull
       @Length(max = 10)
       public String getAgtdna() {
       return this.agtdna;
       }


      After my modification :
      @Column(name = "agtdna", columnDefinition = "bpchar(10)", nullable = false, length = 10)
       @NotNull
       @Length(max = 10)
       public String getAgtdna() {
       return this.agtdna;
       }


      Is there a way to parameter the mapping-types before calling seam generate-entities so that I wouldn't have to modify manually all files? In the same idea, is there a way to parameter which fields are primary key or foreign keys for a table?