Hi,
I have a J2EE application using Hibernate.
Hibernate is configured for auto detection:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit name="sem"> <jta-data-source>java:/mySQLDB</jta-data-source> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <!-- <property name="hibernate.ejb.cfgfile" value="/hibernate.cfg.xml"/> --> <property name="hibernate.hbm2ddl.auto" value="validate"/> <property name="hibernate.archive.autodetection" value="class, hbm"/> <property name="hibernate.show_sql" value="false"/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> </properties> </persistence-unit> </persistence>
I need to add a new property (language) to an existing Entity:
@Entity @Table(name = "user") class { //added property: public String language = ""; public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } }
When recompiling and deploying the application,I'd expect hibernate to add the language field to the underlying database table, but it doesn't.
What else needs to be done for this change to take effect?
I'm new to Hibernate and this is an existing application which I don't know yet very well. Need to make this change anyway. If required I will give more detailed information asap.
|