java - Hibernate generate old query after column renaming -


i've renamed column in database (from configuration_system_id system_id), , added attributeoverride annotation abstractsubconfiguration class. hibernate ignore annotation , continue generate queries old column names (configuration_system_id instead of system_id).

my classes looks this:

abstractsubconfiguration.java

       @mappedsuperclass         @idclass(configuration.class)         public class abstractsubconfiguration implements dto, serializable {             private static final long serialversionuid = -6271877313478924753l;              @id             @onetoone(fetch = fetchtype.lazy)     @attributeoverride(name = "systemid", column = @column(name = "system_id"))             private configuration configuration;              public abstractsubconfiguration() {                 super();             }              public abstractsubconfiguration(final configuration configuration) {                 super();                 this.configuration = configuration;             }              @xmltransient             public final configuration getconfiguration() {                 return configuration;             }              public final void setconfiguration(final configuration configuration) {                 this.configuration = configuration;             }          } 

configuration.java

    entity(name = "configuration")     public class configuration implements dto, serializable {         private static final long serialversionuid = 6601197795258837065l;          @embeddedid         private configurationid configurationid;          @column(name = "configuration_name")         private string configurationname;          @onetoone(cascade = cascadetype.persist, mappedby = "configuration", fetch = fetchtype.eager)         private basicconfiguration basicconfiguration;         @onetoone(cascade = cascadetype.persist, mappedby = "configuration", fetch = fetchtype.eager)         private advancedconfiguration advancedconfiguration;  .....   ... } 

configurationid.java

@embeddable public class configurationid implements serializable {     private static final long serialversionuid = -5123943430808049180l;      private systemid systemid;     @column(name = "configuration_id")     private int configurationid;      public configurationid(final systemid systemid, final int configurationid) {         super();         this.systemid = systemid;         this.configurationid = configurationid;     }     ....      .... } 

and result have error 2695 [main] error org.hibernate.engine.jdbc.spi.sqlexceptionhelper - unknown column 'tes0_.configuration_system_id' in 'field list'

from doc @attributeoverride

java.lang.string name (required) name of property mapping being overridden if property-based access being used, or name of field if field-based access used.

in mapping don't see systemid property instead see configurationid property

edit

accordance editing name in @attributeoverride should configuration.systemid

see example java doc zipcode:

@embeddable public class address {         protected string street;         protected string city;         protected string state;         @embedded protected zipcode zipcode;     }      @embeddable public class zipcode {         protected string zip;         protected string plusfour;     }      @entity public class customer {         @id protected integer id;         protected string name;         @attributeoverrides({             @attributeoverride(name="state",                                column=@column(name="addr_state")),             @attributeoverride(name="zipcode.zip",                                column=@column(name="addr_zip"))         })         @embedded protected address address;         ...     } 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -