• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can an application have both hibernate.properties file and hibernate.cfg.xml

 
Miranda Mosby
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In java hibernate can an application have both hibernate.properties file an hibernate.cfg.xml??
I am trying to implement lucene search but when i add the following code to my cfg.xml file i get an error


<property name="hibernate.search.default.directory_provider"
value="filesystem"/>
<property name="hibernate.search.default.indexBase"
value="D:\dojupload\index>
 
A.J. Côté
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Miranda Mosby wrote:In java hibernate can an application have both hibernate.properties file an hibernate.cfg.xml??



Yes, if you just look for both files in initSessionFactory() I would assume. Why can't you put all configs in the same file?

Please post more details about your setup and especially the details of the error you get like a stacktrace if you have one.

Here is a typical initSessionFactory() where you would to check for both files:

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Miranda Mosby,

First of all, a warm welcome to CodeRanch!

Miranda Mosby wrote:I am trying to implement lucene search but when i add the following code to my cfg.xml file i get an error

Which error do you get? Most people here at the ranch are not clairvoyant, so if you do not TellTheDetails it's hard to know which error you got and to give some proper advice.

Kind regards,
Roel

PS. And you should also UseAMeaningfulSubjectLine as well. I updated the subject line using a much more meaningful one. Hope that's ok for you!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic