[hibernate-issues] [Hibernate-JIRA] Commented: (EJB-227) persistence.xml should be validated by the parser

Philippe Lefebvre (JIRA) noreply at atlassian.com
Thu Sep 21 10:49:24 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-227?page=comments#action_24574 ] 

Philippe Lefebvre commented on EJB-227:
---------------------------------------

My apologies for this early conclusion, as I can see at line 50 of PersistenceXmlLoader.java, the parser is indeed validating.  After further investigation, the problem is with the exclude-unlisted-classes element: in the schema, it's declared as a boolean type but in the code (line 152), whenever the tag is present, it is assumed to be true.  This is in line with the EJB3 Specification but allows for errors where there is a "false" in the tag.  I guess the value inside should be checked, as a safety net.  Something like:

metadata.setExcludeUnlistedClasses(!"false".equalsIgnoreCase(element.getTextContent()));

> persistence.xml should be validated by the parser
> -------------------------------------------------
>
>          Key: EJB-227
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-227
>      Project: Hibernate Entity Manager
>         Type: Improvement

>   Components: EntityManager
>     Versions: 3.2.0.cr2
>     Reporter: Philippe Lefebvre
>     Priority: Minor

>
>
> I had an error in my persistence.xml file that triggered some weird behavior from hibernate.  It took me a long time figuring out what was going on (had to go in the sources to see).  All this could have been avoided if XML validation had been turned on.  It's a one liner with almost no perfomance hit (it's on startup!).

-- 
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