File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes org.hibernate.HibernateException: Missing column: (on an MySQL database) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "org.hibernate.HibernateException: Missing column: (on an MySQL database)" Watch "org.hibernate.HibernateException: Missing column: (on an MySQL database)" New topic
Author

org.hibernate.HibernateException: Missing column: (on an MySQL database)

Mimi Tam
Ranch Hand

Joined: Mar 05, 2010
Posts: 121

Hi,

I was using my root username/password to access a MySQL database via Hibernate / Spring merrily until I made some changes to a couple of tables.

I am now getting an exception right off the bet:

"...Caused by: org.hibernate.HibernateException: Missing column: birth_day in demoDb.consumer
at org.hibernate.mapping.Table.validateColumns(Table.java:254)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1089)
at
....."

The missing column is certainly there.

I tried creating a new user (with DBA privileges) and used that to access the Db instead of root (suggestions found via Google). That didn't help. I created a new user without DBA priviledge and that didn't help either

I don't know what else to try and I cannot get pass this problem. I am stuck.

Please kindly help.

Many Thanks in advance.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The missing column is where--in the DB, or in the mapping?
Mimi Tam
Ranch Hand

Joined: Mar 05, 2010
Posts: 121

I was getting this exception when I was trying to bring up a Hibernate+Spring web app. That was when the first web page was being brought up and my guess is that it was trying to map my POJOs to the database itself. My POJO has this field and my database has this field but the root/root user used to access the database I think is looking at some other residue database from 100 year ago.

"...Caused by: org.hibernate.HibernateException: Missing column: birth_day in demoDb.consumer
at org.hibernate.mapping.Table.validateColumns(Table.java:254)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1089)
at
....."

Now, I simply could not even access the database after I fiddled with the user table. I think regardless of whether it will help, I need to clean out MySQL registries, databases, user tables and what have you after uninstalling MySQL. Start from a clean slate and reinstall MySQL and create new database.

I was not able to get rid of the old user accounts or databases so far...after re-installing MySQL... It's been 2 days running, problem not fixed and I am about to go insane (just a figurative speech, no need to alert the authorities to come check on me...).

Please kindly help....

Many Thanks in advance.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If you've reinstalled MySQL then your users will be gone, unless you were using a custom DB file location or something.
Mimi Tam
Ranch Hand

Joined: Mar 05, 2010
Posts: 121

No David. I was not using custom anything, unfortunately.

I did another reinstall and manual cleanup and re-examined the mysql.user table, for some reason this time, the old users were gone with just the newly created root user in it. However, the old databases are still there. I've gotten rid of the MySQL folder manually. I wonder where they came back from.

I could not login programmatically thru Hibernate, only from the command line.
My root has all previleges *. * root@localhost identified by 'root' with grant option. It also has another root entry (on the user table) with "*%" in place of root@localhost.

What even worse, the re-installing of MySQL this time failed in starting the Service on the last step of the Install. Now mind you, the MySQL registry was manually deleted after I uninstalledl MySQL. It was stopped before I deleted it. I saw the MySQL new registry entry on my Service table with no status and configured as AUTOMATIC on my last step of installation but the installation just sat there (stuck) when it tried to start the service.

Somethings are totally messed up and I need to know how to do a FULL CLEAN-UP for MySQL 5.1 (left-over registry entries, folders, files, etc), hoping that may help my situation.

What would you recommend and where can I find this FULL CLEAN-UP info? I really would very much appreciate any help.

Many Thanks.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: org.hibernate.HibernateException: Missing column: (on an MySQL database)