[hibernate-dev] Documentation on OGM + JBoss AS

Scott Marlow smarlow at redhat.com
Mon Oct 1 13:07:41 EDT 2012


On 10/01/2012 12:23 PM, Sanne Grinovero wrote:
> On 1 October 2012 17:08, Scott Marlow <smarlow at redhat.com> wrote:
>> On 10/01/2012 11:05 AM, Sanne Grinovero wrote:
>>>
>>> On 1 October 2012 15:51, Scott Marlow <smarlow at redhat.com> wrote:
>>>>
>>>> I got further yesterday (after removing the ---PlaceHolderDSForOGM---
>>>> property from HibernateOgmPersistence).  Not sure what the long term
>>>> change is (perhaps we should only add the ---PlaceHolderDSForOGM--- for
>>>> the non-container case).
>>>
>>>
>>> Nice. Is the AS still "mandating" a specific module name and injecting
>>> Hibernate 3?
>>
>>
>> The OGM module name should be org.hibernate:ogm.  The org.hibernate:ogm
>> module should depend on Hibernate 4 (org.hibernate:main) and Hibernate 4
>> should depend on OGM.
>
> I'm still not understanding why we need to hardcode a constant module
> name for the OGM provider, that's unintuitive and brought me a lot of
> pain when trying to use a *different* version, when recently trying
> out your instructions.
>
> I might want to deploy OGM using a different version of Hibernate ORM
> than what I have in another OGM-using application; also it is very
> likely that soon OGM will require a version which is not the one
> bundled in the AS.
>
> I would expect the module to be something I can configure in my own application:

You should be able to specify the module via jboss.as.jpa.providerModule 
(https://docs.jboss.org/author/display/AS72/JPA+Reference+Guide#JPAReferenceGuide-Persistenceunitproperties), 
in which case we don't try to guess the module name based on the 
provider class name.

>
> https://github.com/Sanne/ogm-kitchensink/blob/as711/src/main/webapp/WEB-INF/jboss-deployment-structure.xml

The jboss-deployment-structure.xml allows you to specify what is or 
isn't on the deployment classpath but the classpath is not set early 
enough to be helpful when bootstrapping the persistence unit definitions 
in the persistence.xml.

>
> it should be possible to use a different module name, how could I deal
> with multiple deployments otherwise? The AS should not mandate the
> module dependency, at best it could take some hint like you do with
> the _jboss.as.jpa.adapterModule_ property
>
> https://github.com/Sanne/ogm-kitchensink/blob/as711/.openshift/config/modules/org/hibernate/ogm/module.xml
>
> I didn't need any datasource, this worked fine:
> https://github.com/Sanne/ogm-kitchensink/blob/as711/src/main/resources/META-INF/persistence.xml

I didn't try removing the (h2) datasource from my persistence.xml, I'll 
try doing that.
>
> Sanne
>
>>> Last time I was trying that was driving me nuts, as to workaround it I
>>> needed lots of changes in AS.
>>
>>
>> We should either create a blog update to explain this or as previously
>> discussed on this thread, document the changes needed.
>>
>> http://pastie.org/4891854 is my current persistence.xml that I'm testing
>> with.
>>
>> I had to set jboss.as.jpa.adapterModule to org.jboss.as.jpa.hibernate:4, so
>> that we would use the Hibernate 4 integration code with OGM.
>>
>> I also had to set jboss.as.jpa.classtransformer to false so that we wouldn't
>> try to create the EntityManagerFactory too soon (should probably verify if
>> that is still needed).
>>
>>
>>>
>>> I would expect to not have any OGM-specific code in the AS, but that
>>> it should be good enough to implement the JPA spec correctly regarding
>>> the provider implementation?
>>
>>
>> I sometimes hear that question (why don't you just use the JPA spec
>> bootstrapping).  However, we are allowed by the JPA specification, to pass a
>> map of integration properties when calling the
>> PersistenceProvider.createContainerEntityManagerFactory(PersistenceUnitInfo,
>> Map integrationProperties) call.  Sometimes, the persistence providers
>> include enough version specific application server integration code, so that
>> app servers find that its good enough to just call the JPA spec invocation
>> but in practice this breaks when the app servers change too much.
>>
>> For AS7, I created persistence provider adapters that (optionally) contain
>> the extra integration code that is not handled by the JPA specification.
>> For AS 8.0, I want to change the relationship between the persistence
>> provider adapters and providers to be less tightly coupled (its currently a
>> 1-1) but they make developing JPA applications for AS7 easier for the
>> developer (fewer properties have to be passed in).
>>
>>
>>>
>>>>
>>>> http://pastie.org/4891549 is the out from running one of the example
>>>> applications (jboss-javaee6-webapp).  Obviously, I need to try a
>>>> different test. ;)
>>>
>>>
>>> Right, you might need to simplify an existing test, or take the
>>> ogm-kitchensink as a starting point:
>>> take branch as711 from:
>>> git://github.com/Sanne/ogm-kitchensink.git
>>>
>>> Hardy originally wrote that demo, but I don't remember if we ever
>>> integrated my changes from that branch to have it run on AS 7.1.1.
>>>
>>>> For AS documentation, I'm not sure if we are ready to add that yet (it
>>>> would be experimental with the goal of helping someone get started).
>>>> I'm open to suggestions but I think we could build on what I blogged
>>>> about last year here
>>>>
>>>> http://in.relation.to/Bloggers/UsingADifferentPersistenceProviderWithAS701#H-ExperimentalUseOfOGMOnAS701.
>>>>
>>>> - How to add the OGM module to AS
>>>> - Changing existing AS module dependencies for OGM
>>>> - Infinispan Configuration changes for OGM
>>>> - Example
>>>
>>>
>>> That would be great, are you creating a patch for the docbook in OGM?
>>
>>
>> I created a git branch locally but haven't started the actual doc changes
>> yet.
>>
>> Scott
>>
>>>
>>> Sanne
>>>
>>>>
>>>>
>>>> On 09/27/2012 11:13 AM, Emmanuel Bernard wrote:
>>>>>
>>>>> I'd still prefer a small section in our reference documentation.
>>>>> Stuff in the wiki is as useful as peeing in a violin as we say in
>>>>> France ;)
>>>>>
>>>>> Emmanuel
>>>>>
>>>>> On Thu 2012-09-27  9:52, Scott Marlow wrote:
>>>>>>
>>>>>> On 09/27/2012 09:02 AM, Emmanuel Bernard wrote:
>>>>>>>
>>>>>>> Hey Scott,
>>>>>>>
>>>>>>> I stumbled upon https://hibernate.onjira.com/browse/OGM-117 and
>>>>>>> wondered
>>>>>>> if you could contribute a paragraph or two on how to use Hibernate OGM
>>>>>>> in JBoss AS latest.
>>>>>>> The documentation is hosted in
>>>>>>> http://github.com/hibernate/hibernate-ogm, there
>>>>>>> is a documentation module.
>>>>>>
>>>>>>
>>>>>> I could do that or
>>>>>> https://docs.jboss.org/author/display/AS72/JPA+Reference+Guide might
>>>>>> be another place for the "how to use Hibernate OGM with AS"
>>>>>> documentation.  This link is likely to change like the wind but the
>>>>>> content will be available.
>>>>>>
>>>>>> I'm not sure that either location is better, but I do like using
>>>>>> confluence as users can more easily fix the mistakes.  ;)
>>>>>>
>>>>>> Do you have a preference?
>>>>>>
>>>>>>>
>>>>>>> If you can make it by end of week or Monday, you gain extra karma
>>>>>>> points.
>>>>>>>
>>>>>>
>>>>>> Extra karma points are always good to have!  :)
>>>>
>>>>
>>>> _______________________________________________
>>>> 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