Marshalling a JaxbHbmBasicAttributeType to xml throws a NPE if the generated attribut has not been set whereas the generated attribute of property-element is not declared as use="required" in the hibernate-mapping-4.0.xsd.
See attached test case
explicitely set the generated attribute for JaxbHbmBasicAttributeType. It defaults to never, this value can be safely used.
handle a null argument in org.hibernate.boot.jaxb.hbm.internal.GenerationTimingConverter.toXml(GenerationTiming). See attached patch.
, IIUC, null should not be passed to GenerationTimingConverter#toXml. Please provide an hbm.xml mapping that causes this to happen..
The issue is marshalling the JaxbHbmBasicAttributeType to xml. I know it is not a hibernate main feature and that's why I gave the lower priority. But as the JAXB bindings exist, let make them work... Might be very useful to generate mapping definition programmatically. I provided test cases with with the pull request that reproduce the problem. The simplest .hbm.xml that reproduces the problem is :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
This xml defines a valid mapping, but the generated binding cannot be reverted to xml (Try to marshall the generated JaxbHbmHibernateMapping back to xml).
As you mention, this is outside the scope of Hibernate's use of the JAX bindings. We tend to write these kind of reports off as unsupported usages. This one is trivial enough that I think we can handle it. As long as the attached test really works as a regression (aka, I can use it to reproduce the problem currently) then I will consider it.
Thanks to considerate my request. Please, only take into account the test included in the pull request which is much better than the one attached to this bug report (and I made a mistake attaching the .class instead of .java). I've just re-based my branches on master; the provided tests still reproduce the issues and all tests are still OK after fixing.
Applied PR upstream.