[jboss-user] [EJB 3.0] - Column name clash with SQL keyword

jan_bar do-not-reply at jboss.com
Tue Oct 24 06:11:02 EDT 2006


Hi,

This simple entity won't work with EJB3:


  | public class Attribute implements Serializable {
  | 
  | 	private Long id;
  | 
  | 	private Byte order;
  | 
  | 	@Id
  | 	@GeneratedValue
  | 	public Long getId() {
  | 		return id;
  | 	}
  | 
  | 	public void setId(Long id) {
  | 		this.id = id;
  | 	}
  | 
  | 	public Byte getOrder() {
  | 		return order;
  | 	}
  | 
  | 	public void setOrder(final Byte order) {
  | 		this.order = order;
  | 	}
  | }
  | 

Because JBoss/Hibernate doesn't escape column names with quotes (or DB specific escaping):


  | create table Attribute (id bigint generated by default as identity (start with 1), order tinyint)
  | ..
  | Unexpected token: ORDER in statement
  | 

I don't want to use artificial name for the column, I'd rather see something like this:


  | create table Attribute (id bigint generated by default as identity (start with 1), 'order' tinyint)
  | 

Is there a (db independent) solution?

Thanks Jan

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

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



More information about the jboss-user mailing list