Questions tagged [hibernate.cfg.xml]

hibernate.cfg.xml is the name of the default config file used by Hibernate.

The file usually contains the list of Hibernate mapping files (HBM) for objects that Hibernate persists. It also contains properties that control the behavior of Hibernate.

83 questions
52
votes
9 answers

Where to place hibernate.cfg.xml?

My project is like this: /src/main/java -thegamers -app.java -hibernateutil.java can someone tell me where to put the hibernate.cfg.xml? because I'm getting this error: Initial SessionFactory creation…
Noor
  • 19,638
  • 38
  • 136
  • 254
46
votes
6 answers

how to configure hibernate config file for sql server

Here is the config file for MySQL: org.gjt.mm.mysql.Driver
Lalchand
  • 7,627
  • 26
  • 67
  • 79
19
votes
9 answers

Hibernate - ServiceRegistryBuilder

I'm just trying to learn Hibernate (version 4 final) but I have a problem when trying to create the session factory. Here is some code related to the problem: hibernate.cfg.xml:
Fittersman
  • 625
  • 2
  • 11
  • 22
17
votes
10 answers

ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml] in project root folder

I have the hibernate.cfg.xml file in the project root folder. If I run an application containing: SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); it crashes in the configure() method with the following…
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
7
votes
4 answers

web application - where to place hibernate.cfg.xml file?

I am writing a web application and I have to add hibernate. I configured maven (pom.xml) etc. but now I am getting the following error: exception javax.servlet.ServletException: org.hibernate.HibernateException: /hibernate.cfg.xml not found I am…
Quak
  • 6,923
  • 4
  • 18
  • 22
7
votes
1 answer

Hibernate 4 Annotation Configuration

I'm trying to use Hibernate 4 with annotations only, and a hibernate.cfg.xml file. I've made my own annotation and am using reflection to add this to the configuration. I'm able to use Hibernate 4 in this manner fine, but my configuration is being…
5
votes
0 answers

Envers configuration with hibernate.cfg.xml

I am trying to use Envers to audit the updates/inserts into my tables. I have created audit tables with extension _AUDIT in the DB. But when I actually run the application, I dont see any entries in the audit tables. I even have no errors or…
5
votes
3 answers

org.hibernate.MappingException: Unknown entity: pack1.Persoana

I receive this error and I don't know what is wrong with my hbm.xml file. I use Eclipse Mars and Hibernate 5.0.2. Error: Nov 15, 2015 11:49:19 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {5.0.2.Final} Nov 15, 2015 11:49:19 PM…
Ștefan Blaga
  • 404
  • 1
  • 5
  • 22
4
votes
2 answers

Hibernate mapping resource locate in the separate jar

I have separate jar file has contain hibernate entity mapping and mapping directly. My Hibernate confg (cgf.xml) placed in another jar file. And as result I catch exception "resource: com/iceleads/data/Test.hbm.xml not found". Example: entities.jar…
Tioma
  • 2,120
  • 9
  • 35
  • 52
4
votes
1 answer

How to reference external hibernate.cfg.xml from persistence.xml

I have a JAR file that needs to be deployed into multiple environments, each with their own database connection parameters. Rightly or wrongly, I've been requested to make those database connection parameters external to the JAR. I've seen…
user2913104
  • 41
  • 1
  • 4
4
votes
1 answer

Hibernate bad configurated: Not binding factory to JNDI, no JNDI name configured

This is my "hibernate.cfg.xml", i'm trying to connec to my localhost(postgres) and i'm not sure if i'm typing well the values for the parameters (for example the connection url or the others):
monkeyBug
  • 555
  • 1
  • 4
  • 16
4
votes
2 answers

what is the property name for registering an user type in hibernate

Accoriding to hibernate document: section 6.5. Type registry: http://docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/types.html We can create a new user type and override existing hibernate's basic types. To use the new user type we need to…
xbmono
  • 2,084
  • 2
  • 30
  • 50
4
votes
2 answers

Hibernate Second level Cache <>

I want use second level cache in my hibernate Project but I just know a little about hibernate second level cache, can any one explain how shoud I use this in my code and what configuration and .jar file I need? I set these setting to my…
Am1rr3zA
  • 7,115
  • 18
  • 83
  • 125
3
votes
2 answers

hibernate.cfg.xml path

I have a java project and I am using hibernate.The thing here is I want to place the hibernate.cfg.xml file outside "src" folder, but when I am configuring this file it is showing FileNotFoundException. If I put it inside src folder its ok. But I…
Arat Kumar rana
  • 187
  • 1
  • 5
  • 19
3
votes
1 answer

Can I have two databases related session-factory tags in a single hibernate.cfg.xml file?

I have two different databases where I need to connect and update the tables dynamically. But it looks like I cannot keep two sessions related information in configuration file. Is there any way to handle this ?
Puru
  • 8,913
  • 26
  • 70
  • 91
1
2 3 4 5 6