[jboss-user] [JBoss Seam] - Re: Upgrade from 1.1.6 to 1.2.1

dd_la_frime do-not-reply at jboss.com
Tue Apr 3 09:10:27 EDT 2007


"damianharvey" wrote : I have a project under 1.2.1 with a Text datatype that generated fine. 
  | 
  | Try creating a test database and re-generating (ie. using 'vanilla' SeamGen)

After creating a new seam-project using seam-gen, I've just created a simple Entity Bean mapping an entity in my MySQL database as is :

CREATE TABLE  `dda`.`e_test` (
  |   `test_id` int(10) unsigned NOT NULL auto_increment,
  |   `test_name` varchar(45) NOT NULL,
  |   `test_text` text,
  |   `test_date` timestamp NOT NULL default CURRENT_TIMESTAMP,
  |   `test_number` smallint(5) default NULL,
  |   PRIMARY KEY  (`test_id`)
  | );

the source code of my bean, sorry for the french javadoc ;o)

package com.cmc.dda.bean;
  | 
  | import java.io.Serializable;
  | import java.util.Date;
  | 
  | import javax.persistence.Basic;
  | import javax.persistence.Column;
  | import javax.persistence.Entity;
  | import javax.persistence.GeneratedValue;
  | import javax.persistence.Id;
  | import javax.persistence.Table;
  | import javax.persistence.Temporal;
  | import javax.persistence.TemporalType;
  | 
  | import org.hibernate.validator.Length;
  | import org.hibernate.validator.NotNull;
  | 
  | /**
  |  * La classe Test.
  |  */
  | @Entity
  | @Table(name = "E_TEST")
  | public class Test implements Serializable {
  | 
  |     /**
  |      * Le date.
  |      */
  |     private Date   date   = null;
  | 
  |     /**
  |      * Le id.
  |      */
  |     private int    id     = -1;
  | 
  |     /**
  |      * Le name.
  |      */
  |     private String name   = null;
  | 
  |     /**
  |      * Le number.
  |      */
  |     private int    number = -1;
  | 
  |     /**
  |      * Le text.
  |      */
  |     private String text   = null;
  | 
  |     /**
  |      * Retourne le date.
  |      * 
  |      * @return the date.
  |      */
  |     @Basic(optional = false)
  |     @Temporal(TemporalType.TIMESTAMP)
  |     @Column(name = "TEST_DATE", nullable = false)
  |     public Date getDate() {
  |         return date;
  |     }
  | 
  |     /**
  |      * Retourne le id.
  |      * 
  |      * @return the id.
  |      */
  |     @GeneratedValue
  |     @Id
  |     @Column(name = "TEST_ID", unique = true, nullable = false)
  |     public int getId() {
  |         return id;
  |     }
  | 
  |     /**
  |      * Retourne le name.
  |      * 
  |      * @return the name.
  |      */
  |     @Column(name = "TEST_NAME", nullable = false, length = 45)
  |     @NotNull
  |     @Length(min = 1, max = 45)
  |     public String getName() {
  |         return name;
  |     }
  | 
  |     /**
  |      * Retourne le number.
  |      * 
  |      * @return the number.
  |      */
  |     @Column(name = "TEST_NUMBER")
  |     public int getNumber() {
  |         return number;
  |     }
  | 
  |     /**
  |      * Retourne le text.
  |      * 
  |      * @return the text.
  |      */
  |     @Column(name = "TEST_TEXT")
  |     public String getText() {
  |         return text;
  |     }
  | 
  |     /**
  |      * Positionne le date.
  |      * 
  |      * @param pDate the date to set.
  |      */
  |     public void setDate(Date pDate) {
  |         date = pDate;
  |     }
  | 
  |     /**
  |      * Positionne le id.
  |      * 
  |      * @param pId the id to set.
  |      */
  |     public void setId(int pId) {
  |         id = pId;
  |     }
  | 
  |     /**
  |      * Positionne le name.
  |      * 
  |      * @param pName the name to set.
  |      */
  |     public void setName(String pName) {
  |         name = pName;
  |     }
  | 
  |     /**
  |      * Positionne le number.
  |      * 
  |      * @param pNumber the number to set.
  |      */
  |     public void setNumber(int pNumber) {
  |         number = pNumber;
  |     }
  | 
  |     /**
  |      * Positionne le text.
  |      * 
  |      * @param pText the text to set.
  |      */
  |     public void setText(String pText) {
  |         text = pText;
  |     }
  | }

here is a fragment of the stack trace at the start of jboss :

15:05:08,578 WARN  [ServiceController] Problem starting service persistence.units:ear=deja10ans.ear,
  | unitName=deja10ans
  | javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: TEST_NUMBER, expected: integer
  |         at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
  | 
  |         at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
  |         at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
  | ...
  | 

I forgot to mention that this code is perfectly working on 1.1.6.

Cheers.

Christophe

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

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



More information about the jboss-user mailing list