Home > Programming > Fixing Generating Hibernate mappings files and POJOs from database

Fixing Generating Hibernate mappings files and POJOs from database

Using Netbeans try to add hibernate mapping files and pojos from postgres database:-

Result:

  • No mapping files and pojos generated.
  • IDE log shows warning messages like below
WARNING [org.hibernate.cfg.reveng.JDBCReader]: The JDBC driver didn't report any primary key columns in AccountLine. Asking rev.eng. strategy
WARNING [org.hibernate.cfg.reveng.JDBCReader]: Rev.eng. strategy did not report any primary key columns for Address
WARNING [org.hibernate.cfg.reveng.JDBCReader]: The JDBC driver didn't report any primary key columns in Country. Asking rev.eng. strategy
WARNING [org.hibernate.cfg.reveng.JDBCReader]: Rev.eng. strategy did not report any primary key columns for Country
WARNING [org.hibernate.cfg.reveng.JDBCReader]: The JDBC driver didn't report any primary key columns in User. Asking rev.eng. strategy
WARNING [org.hibernate.cfg.reveng.JDBCReader]: Rev.eng. strategy did not report any primary key columns for User
WARNING [org.hibernate.cfg.reveng.JDBCReader]: The JDBC driver didn't report any primary key columns in UserAccount. Asking rev.eng. strategy
WARNING [org.hibernate.cfg.reveng.JDBCReader]: Rev.eng. strategy did not report any primary key columns for UserAccount
WARNING [org.hibernate.cfg.reveng.JDBCReader]: The JDBC driver didn't report any primary key columns in UserLogin. Asking rev.eng. strategy
WARNING [org.hibernate.cfg.reveng.JDBCReader]: Rev.eng. strategy did not report any primary key columns for UserLogin
WARNING [org.hibernate.cfg.reveng.JDBCReader]: The JDBC driver didn't report any primary key columns in UserStatus. Asking rev.eng. strategy
WARNING [org.hibernate.cfg.reveng.JDBCReader]: Rev.eng. strategy did not report any primary key columns for UserStatus
WARNING [org.hibernate.cfg.JDBCBinder]: Cannot create persistent class for org.hibernate.mapping.Table(public.Address) as no columns were found.
WARNING [org.hibernate.cfg.JDBCBinder]: Cannot create persistent class for org.hibernate.mapping.Table(public.Country) as no columns were found.
WARNING [org.hibernate.cfg.JDBCBinder]: Cannot create persistent class for org.hibernate.mapping.Table(public.User) as no columns were found.
WARNING [org.hibernate.cfg.JDBCBinder]: Cannot create persistent class for org.hibernate.mapping.Table(public.UserAccount) as no columns were found.
WARNING [org.hibernate.cfg.JDBCBinder]: Cannot create persistent class for org.hibernate.mapping.Table(public.UserLogin) as no columns were found.
WARNING [org.hibernate.cfg.JDBCBinder]: Cannot create persistent class for org.hibernate.mapping.Table(public.UserStatus) as no columns were found.

Solution:

  • Make sure all the table and primary key column names are in lower case.
  • Delete the hibernate reverse engineering configuration file and recreate it.
  • Run the wizard to generate mapping files and POJOs.

It did work for me.

Advertisements
Categories: Programming
  1. serdengecti
    August 18, 2013 at 1:57 pm

    many many thanks. really helped saving my day

  2. carpo
    November 9, 2013 at 8:33 am

    many many thanks, really i wouldn’t had figure it out …

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: