History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: APF-678
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Matt Raible
Reporter: Matt Raible
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
AppFuse

Running hibernate3:hbm2ddl does not alter database schema after changes are made to model objects

Created: 05/Mar/07 09:50 AM   Updated: 05/Mar/07 09:58 AM
Component/s: Persistence Layer
Affects Version/s: 2.0-M3
Fix Version/s: 2.0-M4


 Description  « Hide
http://www.nabble.com/hibernate3%3Ahbm2ddl-tf3334873s2369.html

Steps to reproduce:

2.0-m3 struts-basic-archetype

1) Create a new model class and add it to the hibernate.cfg.xml.
2) Run mvn compile hibernate3:hbm2ddl
3) Modify the model class (add a new property or relationship, or even rename something)
4) Repeat step2....your schema table should not have changed. You should get a MVN error to the effect:

create table spectrum_query (id bigint not null auto_increment, scanNumber varchar(255) not null unique, search_summary_id bigint, primary key (id)) type=InnoDB;
[ERROR] SchemaExport - Unsuccessful: create table spectrum_query (id bigint not null auto_increment, scanNumber varchar(255) not null unique, search_summary_id bigint, primary key (id)) type=InnoDB
[ERROR] SchemaExport - Table 'spectrum_query' already exists


 All   Comments   Change History   FishEye      Sort Order:
Matt Raible - 05/Mar/07 09:53 AM
Suggested fix from Rob van Oostrum (http://www.nabble.com/Re%3A-hibernate3%3Ahbm2ddl-p9274276s2369.html):

Add <drop>true</drop> to the <componentProperties> of the hibernate3-maven-plugin