Friday, January 11, 2013

NullPointerException with Hibernate 4

java.lang.NullPointerException at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:207) at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)

The exception above can be resolved by adding this Hibernate property:
<property name="hibernate.temp.use_jdbc_metadata_defaults">false</property>

7 comments:

  1. hi thanks for tip,
    I have here jdbc.properties file where is defined some like:

    hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
    hibernate.show_sql=true

    so may i add this property like
    hibernate.temp.use_jdbc_metadata_defaults=false ?

    ReplyDelete
  2. Hi Erik,

    Apologies for the delayed response. Yes, you are correct.

    ReplyDelete
  3. Thanks a lot. It works for me.

    ReplyDelete
  4. Apologies for the delayed response. Yes, you are correct.

    ReplyDelete