I read when using a persistence provider a configuration file called
Persistence.xml is used to configure the persistence provider. Is the persistence.xml file a standard file used to configure all persistence providers ??
The tutorial I read on the Hibernate website uses configuration files specific to hibernate and does not use the persistence.xml.
My question is : Does every persistence provider have its own set of configuration files and why the persistence.xml is not used in the case of hubernate. [ July 15, 2007: Message edited by: Khaled Mahmoud ]
SCJP, SCJD,SCWCD,SCDJWS,SCEA 5 MCP-C#, MCP-ASP.NET - http://www.khaledinho.com/ Life is the biggest school
Pierre Henry
Ranch Hand
Joined: Oct 01, 2003
Posts: 31
posted
0
Yes, all persistance provider must be configured.
For Hibernate, the persistance provider is in a file called 'hibernate.cfg.xml'
"A good method shouldn't bypass one screen long"<br />"genius is the knowledge left when one has forgotten everything"
Mike Keith
author
Ranch Hand
Joined: Jul 14, 2005
Posts: 304
posted
0
Hi Khaled,
The persistence.xml file is the standard file that must be recognized and read by all providers. Most providers allow many of their implementation-specific properties to be specified in this file. The properties will only be recognized by the provider to which they apply and will be ignored by any other providers so it is reasonably portable.
Sometimes providers do not offer persistence properties for their extra features. In this case you have no choice but to use their own specific file or configuration mechanism. Check with the Hibernate doc to see if you really need to have the hibernate file for the feature that you want to enable as it is obviously not a portable way of configuring things to use proprietary files and you should avoid them when possible.
The hibernate.cfg.xml is if you are not using JPA with Hibernate, if you are, then you will use the persistence.xml file instead of the hibernate.cfg.xml. Of course, this is all for Hibernate version 3.x anyone using a version before will only use the hibernate.cfg.xml.
Mark Spritzler wrote:The hibernate.cfg.xml is if you are not using JPA with Hibernate, if you are, then you will use the persistence.xml file instead of the hibernate.cfg.xml. Of course, this is all for Hibernate version 3.x anyone using a version before will only use the hibernate.cfg.xml.
Mark
So is it true, when you decide to use persistence.xml, then you can remove hibernate.cfg.xml ???