[jboss-user] [Persistence] - @Column atttributes name and length does not work in JBoss5.

harshajbharsha do-not-reply at jboss.com
Fri Sep 11 07:47:32 EDT 2009


  | @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 

  | <?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>
  |   		<class>org.hibernate.ejb.HibernatePersistence</class>
  |   		<properties>
  | 	  		<property name="hibernate.hbm2ddl.auto" value="update" />
  | 	  		<property name="hibernate.show_sql" value="true"/>
  | 	  		<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"></property>
  | 	  		<property name="hibernate.transaction.manager_lookup_class" 
  | 	  		value="org.hibernate.transaction.JBossTransactionManagerLookup" />
  |   		</properties>
  | 	</persistence-unit>  
  | </persistence>
  | 

the table get created. but jpa does not create a column with the name abcde but column1, and the length is always defaults to 255 chars irrespective of the length attribute

i wonder how the basic annotation does not work in JPA. 

Am i missing something? mysql installation, mysql-ds.xml are fine


please help 

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

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



More information about the jboss-user mailing list