Problems using eclipse Hibernate plugin - could not locate sessionfactory in JNDI

后端 未结 2 1064
梦毁少年i
梦毁少年i 2020-12-17 05:14

I\'m using the reverse engineering capabilities built into the eclipse hibernate plugin to generate dao\'s and hbm.xml files for each table.

It does it quite well bu

2条回答
  •  没有蜡笔的小新
    2020-12-17 05:51

    You can either specify all the connection, password, username etc. directly in a hibernate configuration file, and then load using code like:

    Configuration cfg = new Configuration();
    cfg.configure();
    SessionFactory sf = cfg.buildSessionFactory();
    

    Or, you can obtain it from JNDI. This allows your sysadmin to change the connection, password, username etc. after deployment, by registering a different SessionFactory with JNDI.

    You would need to consult your application server's documentation on how to specify JNDI resources with the application server.

提交回复
热议问题