[jboss-user] [JBoss Seam] - bpchar conversion with PostgreSQL

idylle do-not-reply at jboss.com
Thu Mar 15 05:42:49 EDT 2007


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?




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028290#4028290

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4028290



More information about the jboss-user mailing list