Hibernate/Annotation – Error – “Schema-validation: missing column”

Background

Adding more functionality to a POJO ( Plain Old Java Object) class that relies on Annotations.

Error

But, here ended up with an error!

Error Message


Schema-validation: missing column [bResetDependantEntityCountryIDOnDelete] in table [dbo.country]
Failed to create sessionFactory object.org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [bResetDependantEntityCountryIDOnDelete] in table [dbo.country]
Exception in thread "main" java.lang.ExceptionInInitializerError
        at sakila.helloDB.dbWork(helloDB.java:166)
        at sakila.helloDB.run(helloDB.java:55)
        at sakila.helloDB.main(helloDB.java:42)
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [bResetDependantEntityCountryIDOnDelete] in table [dbo.country]
        at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateTable(AbstractSchemaValidator.java:136)
        at org.hibernate.tool.schema.internal.GroupedSchemaValidatorImpl.validateTables(GroupedSchemaValidatorImpl.java:42)
        at org.hibernate.tool.schema.internal.AbstractSchemaValidator.performValidation(AbstractSchemaValidator.java:89)
        at org.hibernate.tool.schema.internal.AbstractSchemaValidator.doValidation(AbstractSchemaValidator.java:68)
        at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:192)
        at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:73)
        at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:309)
        at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:462)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
        at sakila.helloDB.getDBSession(helloDB.java:82)
        at sakila.helloDB.dbWork(helloDB.java:116)
        ... 2 more

Error Image

SchemaValidationMissingColumn.20190516.0828PM.PNG

Code

Outline

  1. “Decorate” variable declaration with the keyword @Transient

Code


    private Boolean bResetDependantEntityCountryIDOnDelete = true;

    public Boolean getResetDependantEntityCountryIDOnDeleteFlag()
    {
        return bResetDependantEntityCountryIDOnDelete;
    }

    public void setResetDependantEntityCountryIDOnDeleteFlag(Boolean value)
    {
    	bResetDependantEntityCountryIDOnDelete = value;
    }

Revision


    //object.org.hibernate.tool.schema.spi.SchemaManagementException:
    //Schema-validation: missing column
    @Transient
    private Boolean bResetDependantEntityCountryIDOnDelete = true;

    public Boolean getResetDependantEntityCountryIDOnDeleteFlag()
    {
        return bResetDependantEntityCountryIDOnDelete;
    }

    public void setResetDependantEntityCountryIDOnDeleteFlag(Boolean value)
    {
    	bResetDependantEntityCountryIDOnDelete = value;
    }

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s