hibernate: missing column count


bart van hecklom

Here is my entity:

@Entity
@Table(name="log_shop")
public class LogShop {

    @Id
    @GeneratedValue
    private int id;

    private String platform;

    @Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
    private DateTime logged;

    @ManyToOne
    private Player player;

    private String type;

    @Column(name="type_value")
    private String typeValue;

    @Column(name="shop_source")
    private String shopSource;

    @Column(name="buy_confirm")
    @Type(type="org.hibernate.type.NumericBooleanType")
    private boolean buyConfirm;

    @Column(name="buy_yes")
    @Type(type="org.hibernate.type.NumericBooleanType")
    private boolean buyYes;

    @Column(name="not_enough_coins")
    @Type(type="org.hibernate.type.NumericBooleanType")
    private boolean notEnoughCoins;

    @Column(name="not_enough_coins_yes")
    @Type(type="org.hibernate.type.NumericBooleanType")
    private boolean notEnoughCoinsYes;

    LogShop() {}

    public LogShop(String platform, DateTime logged, Player player, String type, String typeValue, String shopSource, boolean buyConfirm, boolean buyYes,
            boolean notEnoughCoins, boolean notEnoughCoinsYes) {
        this.platform = platform;
        this.logged = logged;
        this.player = player;
        this.type = type;
        this.typeValue = typeValue;
        this.shopSource = shopSource;
        this.buyConfirm = buyConfirm;
        this.buyYes = buyYes;
        this.notEnoughCoins = notEnoughCoins;
        this.notEnoughCoinsYes = notEnoughCoinsYes;
    }

}

On startup, Hibernate (using hbm2ddl validate) complainsorg.hibernate.HibernateException: Missing column: count in xxxxx.log_shop

But as you can see, there are no named columns referenced in the countentity class . Why does Hibernate require it to exist in the database?

For reference, see the table below:

CREATE TABLE `log_shop` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `platform` varchar(26) NOT NULL DEFAULT 'web',
  `logged` datetime NOT NULL,
  `player_id` int(11) NOT NULL,
  `type` varchar(26) NOT NULL,
  `type_value` varchar(26) NOT NULL,
  `shop_source` varchar(26) NOT NULL,
  `buy_confirm` int(1) NOT NULL,
  `buy_yes` int(1) NOT NULL,
  `not_enough_coins` int(1) NOT NULL,
  `not_enough_coins_yes` int(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
bart van hecklom

Well, that's silly... It turns out that I also accidentally applied @Table(name="log_shop")another entity class to a countcolumn.

Although Hibernate mentions which class and field this is, which is nice.

Related


hibernate exception: missing column (column exists)

Samuel Smith Ok, so in the database, there is a table called distributionCompanies which is created like this: CREATE TABLE `distributionCompanies` ( `distributionCompanyID` INT(11) NOT NULL, `distributionCompanyName` VARCHAR(255) NOT NULL, PRIMAR

hibernate exception: missing column (column exists)

Samuel Smith Ok, so in the database we have a table called distributionCompanies which is created like this: CREATE TABLE `distributionCompanies` ( `distributionCompanyID` INT(11) NOT NULL, `distributionCompanyName` VARCHAR(255) NOT NULL, PRIMARY

hibernate exception: missing column (column exists)

Samuel Smith Ok, so in the database we have a table called distributionCompanies which is created like this: CREATE TABLE `distributionCompanies` ( `distributionCompanyID` INT(11) NOT NULL, `distributionCompanyName` VARCHAR(255) NOT NULL, PRIMARY

Hibernate + JPA: Schema validation: missing column

Alexander Suvorov: I wrote an educational project. This is a simple chat. The stack of backend technologies is Java, Jetty (server, websocket), Hibernate 5.3.7.Final, PostgreSQL. I have a runtime exception org.hibernate.tool.schema.spi.SchemaManagementExceptio

Hibernate + JPA: Schema validation: missing column

Alexander Suvorov: I wrote an educational project. This is a simple chat. The stack of backend technologies is Java, Jetty (server, websocket), Hibernate 5.3.7.Final, PostgreSQL. I have a runtime exception org.hibernate.tool.schema.spi.SchemaManagementExceptio

Hibernate + JPA: Schema validation: missing column

Alexander Suvorov: I wrote an educational project. This is a simple chat. The stack of backend technologies is Java, Jetty (server, websocket), Hibernate 5.3.7.Final, PostgreSQL. I have a runtime exception org.hibernate.tool.schema.spi.SchemaManagementExceptio

Hibernate + JPA: Schema validation: missing column

Alexander Suvorov: I wrote an educational project. This is a simple chat. The stack of backend technologies is Java, Jetty (server, websocket), Hibernate 5.3.7.Final, PostgreSQL. I have a runtime exception org.hibernate.tool.schema.spi.SchemaManagementExceptio

Hibernate + JPA: Schema validation: missing column

Alexander Suvorov: I wrote an educational project. This is a simple chat. The stack of backend technologies is Java, Jetty (server, websocket), Hibernate 5.3.7.Final, PostgreSQL. I have a runtime exception org.hibernate.tool.schema.spi.SchemaManagementExceptio

How to count missing data in each column in python?

Vivian I have a large dataframe with 85 columns. The missing data has been encoded as NaN. My goal is to get the amount of data missing in each column. So I wrote a for loop to create a list to get the amount. But it doesn't work. Below is my code: headers = x

How to count missing data in each column in python?

Vivian I have a large dataframe with 85 columns. The missing data has been encoded as NaN. My goal is to get the amount of data missing in each column. So I wrote a for loop to create a list to get the amount. But it doesn't work. Below is my code: headers = x

How to count missing data in each column in python?

Vivian I have a large dataframe with 85 columns. The missing data has been encoded as NaN. My goal is to get the amount of data missing in each column. So I wrote a for loop to create a list to get the amount. But it doesn't work. Below is my code: headers = x