reset password
Author Message
xytian
Posts: 70
Posted 15:18 Apr 25, 2013 |

while running Hbm2ddl.java, I got an Exception in thread "main" java.lang.NullPointerException
 at sham.util.Hbm2ddl.main(Hbm2ddl.java:24)
,

the source code is:

22        Configuration cfg = (new Ejb3Configuration()).configure(
23            "hibernate-examples", new HashMap<String, Object>() )
24            .getHibernateConfiguration();

What's the possible causes and what files should I check? Thanks.

jrodriguez
Posts: 33
Posted 15:22 Apr 25, 2013 |
It could be "hibernate-example"
cysun
Posts: 2935
Posted 15:25 Apr 25, 2013 |

The name of the persistence unit in Hbm2ddl must match the name specified in persistence.xml.

xytian
Posts: 70
Posted 16:09 Apr 25, 2013 |

It works now, thank you very much!