users@jaxb.java.net

Re: whats the current status of hyperjaxb3?

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Mon, 02 Oct 2006 21:03:08 +0200

Hi James,

> I wonder could we have a brief status report of where hyperjaxb3 is,
> whats there & whats not etc. A description of what each maven module
> actually does would really help :)
>
> So far after noodling around the various projects its a bit hard to
> see what the status is (or even where to start looking :) - I've seem
> plenty of stuff using hibernate but not seen any JPA stuff yet. Can
> hyperjaxb auto-generate JPA POJOs yet? Is there a good example
> somewhere to start with? So far hyperjaxb-hibernate-roundtrip seems to
> be a hand crafted hibernate round trip using hand editted hbm files
> right?

Thanks for the interest. ;)
Okay, here it goes.

1. Status.

I have (more or less) successfully ported Hyperjaxb2 onto JAXB2. Since
Hyperjaxb2 is basically a Hibernate mappings generator, the port is only a part
of what Hyperjaxb3 should be, but it is already a usable part.

That is, Hyperjaxb3 can now do for JAXB2 what Hyperjax2 does for JAXB1. I have
ported some of Hyperjaxb2 test scenarios as well, so in the tests module there
are some tests that do already pass roundtrip testing. The goal is, of course to
port/make all the test scenarios running, but I do not have time to port
everything. I've ported four of the test scenarios as a proof of concept and I
believe other tests can be also made working.

Last week I have started the EJB3 part of Hyperjaxb3. I've started with a simple
EJB3-based unit test which will also be the basis for the EJB3 roundtrip test.
The tests saves and loads some simple entities using the JPA, currently backed
by the Hibernate EntityManager. The goal there is to have a fully-fledged
roundtrip test case which would unmarshall XML with JAXB, save it into the DB
via JPA, load it back and compare initial and resulting objects for equality.
Since the basic unit tests already works, this is now not a big deal to write a
rountrip test.

After that I've started writing the ejb-plugin for JAXB2. The goal is to make a
primitive schema like purchase order pass the EJB3 roundtrip. I've already
implemented some generation, I'm getting closer but it is not yet so far.

So, the status is:
* Hibernate: ported, somehow working, some test scenarios pass roundtrip
testing, not refactored/adapted.
* EJB3: implemented basic unit tests, got initial experience with EJB3/JPA,
started the plugin. PO example is expected to run quite soon.

2. Modules.

Modules can be divided into following groups:

* generic modules (runtime, tools, testing)
* hibernate (hibernate-mapping, hibernate-configuration,
hibernate-customizations, hibernate-roundtrip, hibernate-runtime, hibernate-plugin)
* ejb (ejb-roundtrip, ejb-schemas, ejb-plugin)
* maven (maven, maven-testing)
* tests (tests, tests-ejb)

2.1. Generic modules.

Generic modules actually better suit jaxb2-commons project and will be probably
moved there some time in the future. This is generic functionality which has
nothing specific to the persistence semantics of Hyperjaxb3.

2.1.1. runtime

Contains some interfaces and classes which will be used in the runtime. For
instance, if you use equals or hashCode plugins from the hyperjaxb3-tools (next
module), they will make your JAXB classes implement Equals, HashCode or ToString
interfaces which are defined in the runtime module.

2.1.2. tools

Contains generic JAXB2 tools and plugins like toString, equals, hashCode etc.

2.1.3. testing

Generic testing framework. Defines, for instance, an AbstractSamplesTest which
will execute some checks (implemented bu subclasses ) against the *.xml files
from src/test/samples.

2.2. Hibernate modules.

2.2.1. hibernate-mapping and hibernate-configuration

These two modules are just JAXB compilation of Hibernate mapping and
configuration DTDs. Hyperjaxb3 uses these modules to generate the XML of
Hibernate mapping and configuration files. Rather than generate XML directly,
Hyperjaxb3 produces object structures which are then serialized.

2.2.2. hibernate-customizations

This is a JAXB compilation of the Hyperjaxb3 Hibernate customizations schema.
Generated mapping are customized by the XML fragments defined either within the
schema (in xsd:annotations) or externally in binding files (xjb). Being XML,
customizations respect their own schema which is compiled with JAXB in this
module. So internally Hyperjaxb3 works with object representation of
customizations rather than with XML directly.

2.2.3. hibernate-roundtrip

Roundtrip tests for Hibernate: unmarshall, save, load, compare.

2.2.4. hibernate-runtime

Runtime classes and interfaces. For instance, Hibernate custom types,
implementation of accessors etc.

2.2.5. hibernate-plugin

Implementation of the JAXB2 Hyperjaxb3 Hibernate plugin. This is what generates
*.hbm.xml and *.cfg.xml.

2.3. EJB modules.

They are under and active development rioght now.

2.3.1. ejb-roundtrip

Similar to hibernate-roundtrip but via JPA.

2.3.2. ejb-schemas

JAXB compilation of persistence_1_0.xsd and orm_1_0.xsd. I'll need them to
generate META-INF/persistence.xml and possible XML mappings.

2.3.3. ejb-plugin

Responsible for generating JPA-annotated entities.


2.4. Maven

2.4.1. maven

Hyperjaxb3 plugin for Maven.

If you use maven-jaxb2-plugin and want to use Hyperjaxb3 as well, you'll have to
add Hyperjaxb3 dependencies and turn on the JAXB2 Hyperjaxb3 plugin using the
<args/> in the plugin config. maven-hyperjaxb3-plugin does it for you. It adds
all the required dependencies, activates the necessary JAXB2 plugins, and
provides convenient means of configuration.

2.4.2. maven-testing

Testing infrastructure for maven-hyperjaxb3-plugin. Allows to configure and
execute the maven-hyperjaxb3-plugin in the frame of an automated test (unit
test). Very useful when debugging JAXB2 plugins

2.5 Tests

These modules contains test scenarios. Each test scenario is a just a small
project built with Maven/Hyperjaxb3. It typically contains a schema and a number
of sample files. Each test scenatio has an own Maven build. During this build,
the schema is processed with JAXB2/Hyperjaxb3 and generated code is compiled.
Test scenarios also typically generate roundtrip test cases. So at the end,
generated code is checked for roundtripping against the sample files.

2.5.1 tests

These are Hibernate tests. There are plenty of them but only four are currently
deployed. Other test are just taken from Hyperjaxb2. They should theoretically
work, but must be adapted (like namespaces and so on).

2.5.2. tests-ejb

These will be tests for the upcoming ejb-plugin. There's only one po test there
currently.

So that's it.

My next goal is to make tests-ejb/po pass the roundtrip test. This should be
doable within next days.

Bye.
/lexi