Help

Entries Added
Inactive Bloggers

In Hibernate there is a particular branch of logic where we need to parse and validate an org.xml.sax.InputSource that might represent either a Hibernate mapping (hbm.xml) file, a 1.0-compliant orm.xml file or a 2.0-compliant orm.xml file. Now currently Hibernate mapping files are defined by a DTD and both versions of the orm.xml files by an XSD. Currently the code builds a SAXReader with DTD and Schema validation enabled and tries to read in the source. It first maps Schema validation to the 2.0 version of the XSD; if an error occurs it then tries re-parsing mapping Schema validation to 1.0 version of the XSD.

Now I am not an XML guru, but this seemed wasteful to me. But try as I could I could not find a way to say that we need to resolve the XSD to one file (locally) if the root element defined version=2.0 as an attribute versus another if it defined version=1.0. Really I guess its a matter of conditionally resolving the schemaLocation. Anyone know if this is possible?

My next thought was to leverage the javax.xml.validation.Validator contract added in JDK 1.5. So basically, I would enabled DTD validation of the document during parse and simply parse the document initially. Then I peeked at the root element to see if the document was a Hibernate mapping or an orm.xml. If an orm.xml, I then check its version attribute, load a Validator based on the proper XSD and do a Validator.validate( new DOMSource(...) ). First, due to the separate parse and then validate steps, just how much slower will this be?

Also, I had a very irksome issue with this approach anyway. In my tests I created a document that is valid according to the 2.0 schema, but I identified the version as 1.0 and used the 1.0 version of the Schema. When running in (Sun) JDK 1.6 the test was successful in that the validator did in fact complain; but on (Sun) JDK 1.5 the validator simply did not complain at all. 1.5 and 1.6 appear to be using different internal SchemaFactory implementations. 1.6 used com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory, while 1.5 used com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl.

Perhaps I am just doing something wrong? The code can be seen at https://fisheye2.atlassian.com/browse/Hibernate/core/trunk/core/src/main/java/org/hibernate/util/xml/MappingReader.java?r=20321#l118 (its the commented out code).

Assuming I did not make a mistake, what is the best way around this?

03. Sep 2010, 23:22 CET, by Jason Greene

Very rarely do I find a tool that doesn't have some issue I have to workaround (even minor). Even more rarely do I find a tool that continues to impress me beyond what I thought I needed.

Git is such a tool.

01. Sep 2010, 21:25 CET, by Steve Ebersole

Hibernate 3.6.0.Beta4 has been released incorporating mostly minor bugfixes and improvements. Most of the work this cycle went into the improved documentation. For those not aware we are planning on splitting the documentation into 2 books:

  1. a Getting Started Guide, see HHH-5441 : this is a collection of tutorials and information on the Hibernate community, etc.
  2. a Developer Guide, see HHH-5466 : this is essentially the information from the existing manual, but presented in a more topical fashion.

The Getting Started Guide is mostly done. There is a single subtask outstanding to incorporate a tutorial on basic Envers usage, but it already contains tutorials on basic Hibernate using (both with hbm.xml and annotation usage) as well as a basic JPA usage tutorial. They all build on the same schema and domain classes, in hopes it will be useful illustrating how to move from one paradigm to another. In fact they all perform the exact same steps for illustration (except for the Envers tutorial when it gets done, since it need to present a very different use case to usefully show Envers usage).

We also are trying out actually bundling up the tutorials in a working project this time (a maven mutli-module project) to make it even easier to get up and running with the tutorials. We are still working through the details of hosting that in terms of referencing the zip from the tutorials (thats the problem with modularizing stuff). Anyway, in the interm I thought this one was close enough that I went ahead and made it available from http://dl.dropbox.com/u/3636512/getting-started-guide/index.html. Some notes:

  • This url is only made available temporarily
  • The documentation references a link to obtain the code. That link is not accurate. We are still deciding where these will live and how they will be referenced. In the meantime I have zipped up the code and made it available here: http://dl.dropbox.com/u/3636512/getting-started-guide/tutorials.tar.gz (again temporarily).

See http://hibernate.org/downloads.html for details on obtaining the release. Or try http://dl.dropbox.com/u/3636512/getting-started-guide/index.html#hibernate-gsg-obtain ;)

Please report any issues to JIRA. Visit us on IRC or the forums if you have usage questions.

01. Sep 2010, 15:09 CET, by Jay Balunas

The RichFaces team has just released 4.0.0.M2, and we are one more milestone closer to the Final. This is our second monthly milestone release, with new components, bug fixes, and other updates. We also worked hard to stabilize the core, CDK, build system, and previously migrated components.

You can download the distribution at our RichFaces download page. The RichFaces-4.0.0.M2 distribution has everything you need to get started. Check out the readme.txt files for any details, or dependencies. If you are a maven user you can follow the instructions here: How to add RichFaces 4.X to Maven Based Project. Note that with the build updates some of the maven information has changed.

Some notable updates:

For all the details you can review the 4.0.0.M2 Release Notes. and please let us know of any problems for bugs you may find.

Next Up Milestone 3

In Milestone 3 we are ramping up component development, including calendar, autoComplete behavior, tabPanel, messages, collapsiblePanel, inplaceSelect, and more. This release is scheduled for late September, early October.

If we are missing your favorite component, or if you find an issue please let us know either through our forums, or our project jira. You can also see our current plans by following the 4.0.0.Milestone3 project in jira, or dropping by one of our public IRC meetings. See our Project Calendar and the Meeting Information page for more details, agendas, and minutes.

So What About the Final Release

We are in the process of evaluating the remaining components, and features for the Final release. Although our schedule have slipped due to unforeseen issues, we still plan to get the Final release out as soon as possible. More to come…

[Project Site] [Downloads] [JIRA] [User Forums] [Design Forums] [RichFaces Twitter]

The final re-post to remind you to use the feeds from JBoss Tools to get JBoss tooling news ;)

Blogging about upcoming webinar tomorrow, the Cloud efforts and bringng back life to a BPEL project.

See it at JBoss Tools Blog

Showing 1 to 5 of 724 blog entries