on 2018 Jun 22 3:45 PM
Good day everyone,
we are using Hybris 6.6.0.0 and added a Attribute (localized:java.lang.String) to Product with the name "newField" via items.xml We deployed the new Attribute and added Values to the Attribute. After a while we discovered that the Attribute is not needed and removed it from the item.xml. After we deployed the changes again SyncJobs were failing because the Job tried to read the Values from the removed Attribute.
In Previous Versions we added and removed Fields without Problems. Is this a Bug or the new behavior of Hybris?
Request clarification before answering.
To completely remove an attribute from hybris and DB either you need to initialize after changing items.xml or you have manually run a SQL query on DB to remove the column(or else a groovy script) and then do an update from HAC.
Run this impex for removing attribute:
REMOVE AttributeDescriptor; qualifier[unique = true]; enclosingType(code)[unique = true]
; newField ; Product
And Then run this groovy script from HAC in commit mode on to remove it from DB:
import org.springframework.jdbc.core.JdbcTemplate
JdbcTemplate jdbcTemplate = spring.getBean("jdbcTemplate")
try {
int rows = jdbcTemplate.update("ALTER TABLE products DROP COLUMN {yourdatabasecolumname};")
} catch (Exception e) {
println(String.format("'%s'", e.getMessage()))
}
column name in DB is usually p_attributename
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.