Friday, 15 March 2013

java - hibernate.cfg.xml not found by Play Framework -



java - hibernate.cfg.xml not found by Play Framework -

i new play framework. migrating project struts2 play uses hibernate orm. have singleton class called hibernateconfig loads hibernate configuration next error.

in c:\users\user\ideaprojects\projectname\app\data\hibernateconfig.java @ line 27. [hibernateexception: /hibernate.cfg.xml not found] private static sessionfactory sessionfactory; private hibernateconfig (){} 23 public static sessionfactory getsessionfactory () 24 { 25 if (sessionfactory == null) 26 { 27 sessionfactory = new configuration ().configure().buildsessionfactory(); 28 homecoming sessionfactory; 29 } 30 else 31 homecoming sessionfactory; }

this how project construction like:

app -> controllers -> application controller class app -> models -> model classes app -> info -> hibernateconfig.java app -> views -> html files app -> hibernate.cfg.xml

application.conf

database configuration

db.default.driver=com.mysql.jdbc.driver db.default.url="jdbc:mysql://localhost/dbname" db.default.user=root db.default.password=""

i know problem hibernate.cfg.xml not beingness located when called new configuration ().configure().buildsessionfactory() don't know must placed in play accessed. (could u guys critic approach , allow me know if i'm going wrong way)

add hibernate.cfg.xml file root of conf folder , should solve problem.

java hibernate playframework-2.0

No comments:

Post a Comment