I know that at least some users are combining JiBX with Hibernate, and haven't heard of any problems. I've used the combination myself in a couple of cases.

There definitely are differences in structure between XML representations and what Hibernate wants for the database mapping, so I think these two work well together - JiBX gives you the flexibility you need to go between the XML and the database structure. This can include things such as bidirectional one-to-many/many-to-one links (which can easily be added to unmarshalled objects by using a factory, pre-set, or post-set method in the binding definition to set a link to the owning object).

I'd love to see more done with combining the two. There are philosophical differences between the Hibernate approach and the JiBX approach (Hibernate requires get/set methods, for instance, and does everything at runtime; JiBX uses methods or fields, and prefers buildtime binding) but these don't interfere at the practical level as far as I've seen.

- Dennis

Gardner, Aaron wrote:

In a nutshell, I've begun prototyping a Java app that uses JiBX to
unmarshall XML files into objects and Hibernate to persist said objects to a
RDBMS.

So far JiBX and Hibernate play nicely together in my small app, but since
these libs use different byte code enhancement techniques, I want to confirm
that they won't conflict in any way. I searched the docs and list archives
but basically found no mention of Hibernate, so my questions are:

1) Does anyone know definitively if it's safe to use the same classes with
JiBX and Hibernate in the same app/JVM? Is it always/sometimes/never safe?


2) If it's only sometimes safe to share classes, which JiBX/Hibernate
features specifically cause problems?

3) Are there explicit goals/plans to make these 2 libs compatible?

4) Regardless of technical compatibility, does anyone have any
experience/opinions on whether or not it's a good idea to try and
reuse/share the same classes for both JiBX unmarshalling and Hibernate
persistence in the same app?

I'm guessing there are certain situations where the JiBX-friendly object
structures are not exactly the same as those that work well with Hibernate's
OO-DB mapping.


In my case I have no control over the XML but full control over the objects
and DB schema. However, over time I can see not wanting to be forced to
modify persistence objects/mappings just because a new/different XML file
dictates some structural change to the unmarshalled objects.

Has anyone tried having 2 separate class hierarchies (2 views of the same
logical entities), one for JiBX and one for Hibernate and using an explicit
transformation step to go from one to the other?

Thanks,
Aaron


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users





-- Dennis M. Sosnoski Enterprise Java, XML, and Web Services Training and Consulting http://www.sosnoski.com Redmond, WA 425.885.7197




-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to