[jboss-dev-forums] [Persistence Development] - JPA @Column annotation does not work in JBoss5.x, MySQL [my

harshajbharsha do-not-reply at jboss.com
Tue Sep 1 06:00:16 EDT 2009


@Column atttributes name and length does not work in JBoss5.x

here is the code:


  | @Entity
  | public class ColumnAttribsTesting {
  | 	
  | 	@Id
  | 	@GeneratedValue(strategy=GenerationType.AUTO)
  | 	private Integer id;
  | 
  | 	private Integer column1 ;
  | 	
  | 	private Integer column2 ;
  | 	
  | 	public ColumnAttribsTesting() {
  | 		
  | 	}
  | 
  | 	public Integer getId() {
  | 		return id;
  | 	}
  | 
  | 	public void setId(Integer id) {
  | 		this.id = id;
  | 	}
  | 
  | 	@Column(name = "abcde", length=1024)
  | 	public Integer getColumn1() {
  | 		return column1;
  | 	}
  | 
  | 	public void setColumn1(Integer column1) {
  | 		this.column1 = column1;
  | 	}
  | 
  | 	public Integer getColumn2() {
  | 		return column2;
  | 	}
  | 
  | 	public void setColumn2(Integer column2) {
  | 		this.column2 = column2;
  | 	}
  | 
  | }
  | 

persistence.xml

anonymous wrote : 
  | 
  | <?xml version="1.0" encoding="UTF-8"?>
  | <persistence xmlns="http://java.sun.com/xml/ns/persistence"
  |     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
  |     http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
  |     
  | 	<persistence-unit name="atspu" transaction-type="JTA">
  |   		<jta-data-source>java:ats</jta-data-source>
  |   		org.hibernate.ejb.HibernatePersistence
  |   		
  | 	  		
  | 	  		
  | 	  		
  | 	  		
  |   		
  | 	</persistence-unit>  
  | 
  | 


it does not create a column with the name abcde, and the length is always defaults to 255 chars

i wonder how the basic annotation does not work..
sure i am doing something silly.. 


please help



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

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



More information about the jboss-dev-forums mailing list