[hibernate-issues] [Hibernate-JIRA] Created: (HBX-1107) <jdbcconfiguration> tag does not support the <mapping> tags defined in the hibernate.cfg.xml

Julien Kronegg (JIRA) noreply at atlassian.com
Tue Jan 27 11:14:40 EST 2009


<jdbcconfiguration> tag does not support the <mapping> tags defined in the hibernate.cfg.xml
--------------------------------------------------------------------------------------------

                 Key: HBX-1107
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1107
             Project: Hibernate Tools
          Issue Type: Bug
          Components: ant
    Affects Versions: 3.2beta10
         Environment: JDK 1.5.0 (IBM J9 VM 2.3)
            Reporter: Julien Kronegg
            Priority: Minor


Hibernate Tools documentation states that Ant tasks can be configured using JDBC configuration (http://www.hibernate.org/hib_docs/tools/reference/en/html_single/#d0e1053). Specifying already existing mappings is allowed by two means:
1) in the hibernate.cfg.xml
2) in a Ant fileset as a child of the <jdbcconfiguration> tag

The parent <configuration> tag documentation states that a standard Ant fileset can be inserted to include hibernate mapping files and prevent from duplicating mappings in hibernate.cfg.xml:	

  "A standard Ant fileset. Used to include hibernate mapping files.Remember that if mappings are already specified in the hibernate.cfg.xml then it should not be included via the fileset as it will result in duplicate import exceptions."

This suggests that both mapping are valid.


The problem is:
When specifying a <jdbcconfiguration .. configurationfile="hibernate.cfg.xml"> the <mapping> tags defined in the hibernate.cfg.xml are ignored (however, using the "fileset" solution works).

This problem comes from the org.hibernate.cfg.JDBCMetaDataConfiguration class: the parseMappingElement(Element,String) method does not allow parsing mapping elements because ignoreconfigxmlmapppings is set to true.
In this case, hibernate tools logs the following message:

  [hibernatetool] Oct 7, 2008 9:18:27 AM org.hibernate.cfg.JDBCMetaDataConfiguration parseMappingElement
  [hibernatetool] INFO: Ignoring null mapping

The message "Ignoring null mapping" (where null is the <session-factory> name property) is not very useful. 

Things to be corrected:
1) in org.hibernate.cfg.JDBCMetaDataConfiguration, the log message 
  log.info("Ignoring "+name+" mapping");
should be replaced by
  log.info("Ignoring session-factory "+(name!=null?name+" ":"")+"mapping: "+subelement.asXML()+" (jdbcconfiguration tags does not support mapping in the hibernate.cfg.xml file. Please use ant fileset instead)");

2) the JDBC configuration documentation should state that mappings in the hibernate.cfg.xml file are ignored.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list