-
1. Re: Upgrade from 1.1.6 to 1.2.1
damianharvey Apr 3, 2007 4:49 AM (in response to dd_la_frime)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) -
2. Re: Upgrade from 1.1.6 to 1.2.1
fady.matar Apr 3, 2007 6:51 AM (in response to dd_la_frime)Can you post the code of the bean that generates this error?
-
3. Re: Upgrade from 1.1.6 to 1.2.1
dd_la_frime Apr 3, 2007 7:13 AM (in response to dd_la_frime)"fady.matar" wrote:
Can you post the code of the bean that generates this error?
I can but there's nothing to do with the code as it is working perfectly with 1.1.6.
I think there was a slightly change in a configuration file for hibernate in seam.
It's the only thing I can see for now. -
4. Re: Upgrade from 1.1.6 to 1.2.1
dd_la_frime Apr 3, 2007 9:10 AM (in response to dd_la_frime)"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 -
5. Re: Upgrade from 1.1.6 to 1.2.1
dd_la_frime Apr 3, 2007 9:16 AM (in response to dd_la_frime)If I modify the datatype of TEST_NUMBER column to integer, I have the next error :
15:14:04,062 WARN [ServiceController] Problem starting service persistence.units:ear=deja10ans.ear, unitName=deja10ans javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: TEST_TEXT, expected: varchar(255) 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)
And this was working great on 1.1.6, again and again !
Christophe -
6. Re: Upgrade from 1.1.6 to 1.2.1
norman.richards Apr 3, 2007 1:24 PM (in response to dd_la_frime)Are you sure schema validation was enabled before? I can't imagine it was.
-
7. Re: Upgrade from 1.1.6 to 1.2.1
dd_la_frime Apr 4, 2007 2:37 AM (in response to dd_la_frime)"norman.richards@jboss.com" wrote:
Are you sure schema validation was enabled before? I can't imagine it was.
What do you mean by that ? Do I have to modify something in the configuration files like persistence.xml ?
cheers. -
8. Re: Upgrade from 1.1.6 to 1.2.1
dd_la_frime Apr 4, 2007 2:47 AM (in response to dd_la_frime)Thank you very much Norman,
I had indeed in my persistence-dev.xml the following line in 1.1.6 :
and in 1.2.1
So for the moment I change the value of the "value" attribute to update and it's working. I don't know if it's the good choice but I don't know very well hibernate, I used to develop with OJB. ;o).
Thanks again.
Christophe. -
9. bad copy/paste
dd_la_frime Apr 4, 2007 2:49 AM (in response to dd_la_frime)As I had a problem with copy and paste I repost my previous post :
Thank you very much Norman,
I had indeed in my persistence-dev.xml the following line in 1.1.6 :
<property name="hibernate.hbm2ddl.auto" value="update" />
and in 1.2.1
<property name="hibernate.hbm2ddl.auto" value="validate" />
So for the moment I change the value of the "value" attribute to update and it's working. I don't know if it's the good choice but I don't know very well hibernate, I used to develop with OJB. ;o).
Thanks again.
Christophe.