[hibernate-dev] Java 6, 7 and 8... oh my!

Gunnar Morling gunnar at hibernate.org
Tue Apr 7 05:06:21 EDT 2015


Binding on Java 7/8 at runtime should work just fine.

I've sent PR https://github.com/hibernate/hibernate-orm/pull/930 to update
XJC and configure the "target" parameter. I've built that branch with JDK 8
successfully, all tests pass.

I've also checked where the required() attribute actually is used within
JAXB (RI), and it only is referenced during schema generation (to generate
minOccurs=0 in derived schema documents if an element is not required) but
apparently not at runtime.


2015-04-07 1:08 GMT+02:00 Steve Ebersole <steve at hibernate.org>:

> So if we get target to work on these XJC tasks and generate JAXB models
> without required... does that hinder runtime binding at all in Java 7/8?
>
> On Thu, Apr 2, 2015 at 9:50 AM, Steve Ebersole <steve at hibernate.org>
> wrote:
>
>> I just want the one that "works" :)
>>
>> On Thu, Apr 2, 2015 at 9:37 AM, Gunnar Morling <gunnar at hibernate.org>
>> wrote:
>>
>>> It also works with that task from JAXB Commons when updating the JAXB
>>> Commons libs (and JAXB itself). That task has the "target" parameter in
>>> newer versions. I can send you a PR for that update.
>>>
>>> 2015-04-02 16:08 GMT+02:00 Gunnar Morling <gunnar at hibernate.org>:
>>>
>>>> Had a quick look into (1).
>>>>
>>>> The "target" parameter is not supported by that version of the Ant task
>>>> currently in use. If I change the class name of the Ant task from
>>>> "org.jvnet.jaxb2_commons.xjc.XJC2Task" into "com.sun.tools.xjc.XJC2Task",
>>>> the "target" parameter is recognized and setting it to "2.0" causes no
>>>> required() attribute to be generated for @XmlElementRef.
>>>>
>>>> Do you remember why that task from JAXB Commons is used rather than the
>>>> original XJC one?
>>>>
>>>> 2015-04-02 15:19 GMT+02:00 Steve Ebersole <steve at hibernate.org>:
>>>>
>>>>> After considering this some more, I think moving to Java 8 as baseline
>>>>> is
>>>>> just not reasonable yet.  And tbh I just do not see a compelling
>>>>> reason to
>>>>> move to Java 7 as the baseline.  So if reasonably possible I would
>>>>> still
>>>>> like to remain backwards compatible with Java 6.
>>>>>
>>>>> The only hurdle I believe is this JAXB point.  I see 2 options...
>>>>>
>>>>> 1) Make certain our code is compatible with JAXB 2.0.  I am not well
>>>>> versed
>>>>> enough in JAXB features between its versions yet to know how good of an
>>>>> idea this is.
>>>>>
>>>>> 2) make our codr compatible with the newer JAXB version.  This works
>>>>> as-is
>>>>> in Java 7 and 8 runtimes.  For use in Java 6 runtimes, users would
>>>>> need to
>>>>> update the JAXB used in their JDK/JRE.  Doing so is a well defined
>>>>> process
>>>>> using endorsed libs.  See
>>>>>
>>>>> http://docs.oracle.com/javase/6/docs/technotes/guides/standards/index.html
>>>>>
>>>>> I think option (1) is the way to go, but do not have a lot of
>>>>> experience
>>>>> here.  What do y'all think?
>>>>> On Apr 1, 2015 6:34 AM, "Steve Ebersole" <steve at hibernate.org> wrote:
>>>>>
>>>>> > Baseline on Java 8?  Hmm... Well thanks for tempting me :)
>>>>> >
>>>>> > What do you mean by "be able to experiment with significant API
>>>>> > improvements"?
>>>>> >
>>>>> > On Tue, Mar 31, 2015 at 7:18 PM, Sanne Grinovero <
>>>>> sanne at hibernate.org>
>>>>> > wrote:
>>>>> >
>>>>> >> I wouldn't disagree on requiring Java 7.
>>>>> >> I probably wouldn't disagree with Java 8 either, after all we're not
>>>>> >> removing older versions of Hibernate from any download location and
>>>>> >> we'll still support and maintain some older versions. It would
>>>>> >> actually be nice to have the latest ORM version to be able to
>>>>> >> experiment with significant API improvements.
>>>>> >>
>>>>> >> FYI Hibernate Search is requiring Java 7 already, and our CI servers
>>>>> >> are already testing our projects with JDK9 as well.
>>>>> >>
>>>>> >> That said, Java 6 is still being supported by some vendors. Not by
>>>>> >> Oracle, but Red Hat and SAP will support it for much longer.
>>>>> >>
>>>>> >> -- Sanne
>>>>> >>
>>>>> >> On 1 April 2015 at 01:04, Steve Ebersole <steve at hibernate.org>
>>>>> wrote:
>>>>> >> > So we now have to deal with a multi-jdk build in Hibernate ORM.
>>>>> We need
>>>>> >> > Java 8 in order to compile the new hibernate-java8 module.
>>>>> >> >
>>>>> >> > I wanted to remain compatible with Java 6 for the rest.  However,
>>>>> I ran
>>>>> >> > into a snag there because of JAXB which we now use (in
>>>>> conjunction with
>>>>> >> > StAX) to process XML in ORM.  ANyway, the JAX generation creates
>>>>> a model
>>>>> >> > that is only compatible with Java 7.  I have not yet had time to
>>>>> >> > investigate this deeply.  But it has to do with a change in the
>>>>> >> definition
>>>>> >> > of javax.xml.bind.annotation.XmlElement and a change in its
>>>>> definition
>>>>> >> > between 1.6 and 1.7 to add a new
>>>>> >> > attribute javax.xml.bind.annotation.XmlElement#required.
>>>>> >> >
>>>>> >> > If anyone is familiar with this situation, I'd love to hear some
>>>>> options
>>>>> >> > before I spend a lot of time investigating it.
>>>>> >> >
>>>>> >> > The other option is that we say we are going to drop Java 6
>>>>> support
>>>>> >> since
>>>>> >> > it has been unsupported now for, what, 3 years?
>>>>> >> > _______________________________________________
>>>>> >> > hibernate-dev mailing list
>>>>> >> > hibernate-dev at lists.jboss.org
>>>>> >> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>>> >>
>>>>> >
>>>>> >
>>>>> _______________________________________________
>>>>> hibernate-dev mailing list
>>>>> hibernate-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>>>
>>>>
>>>>
>>>
>>
>


More information about the hibernate-dev mailing list