It is giving error when I try to do the ORM

0

I created a table but when I run the application more than once it gives this problem. Why does this happen?

environments {
  development{
    dataSource {
        dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
        url = "jdbc:jtds:sqlserver://localhost:1433/G2017;instance=SQLEXPRESS";
        username = "sa"
        password = "G2017"
        loggingSql = false
    }
}




Error |
2015-12-29 20:06:21,141 [localhost-startStop-1] ERROR       hbm2ddl.SchemaUpdate  - HHH000388: Unsuccessful: alter table   MATERIAL_CONSULTA add MCO_ANE_in_id  bigint not null
Error |
2015-12-29 20:06:21,156 [localhost-startStop-1] ERROR  hbm2ddl.SchemaUpdate  - Column names in each table must be unique. Column  name 'MCO_ANE_in_id' in table 'MATERIAL_CONSULTA' is specified more than once.
Error |
2015-12-29 20:06:21,177 [localhost-startStop-1] ERROR hbm2ddl.SchemaUpdate  - HHH000388: Unsuccessful: alter table MATERIAL_CONSULTA add constraint FK_3u9950vreiqdafld873700mg5 foreign key (MCO_ANE_in_id ) references ANEXO
Error |
2015-12-29 20:06:21,177 [localhost-startStop-1] ERROR   hbm2ddl.SchemaUpdate  - There is already an object named 'FK_3u9950vreiqdafld873700mg5' in the database.
    
asked by anonymous 30.12.2015 / 00:27

1 answer

0

Grails (through Hibernate) is trying to create the MCO_ANE_in_id column, but it already exists in your database. Please post the code of your MaterialConsult class to see if this column is not mapped twice in the database. If this is the case, it will make a mistake.

    
02.01.2016 / 14:14