The isNeo4j() is just a trick so that the user does not have to set a
property. I'm also not totally happy about it
Neo4j seems to allow for this via the TransactionManagerProvider SPI.
Unfortunately one isn't in control of instantiating such providers, though.
So one would have to do some hackery using a static variable, ThreadLocal
or similar to pass in the JtaPlatform. WDYT, would that make sense?
This was actually the original intention. I've tried to hack a bit in the
interface but in the end there was always something not working (at some
point I was able to inject the JtaPlatform in Neo4j but I don't remember
how to do it). In the end this one was the easiest one to implement.
I'm happy if you want to explore this solution but I think we should talk
with the Neo4j guys first to see if it is possible to add an option to pass
an already created object.
It seems easier and it doesn't requires hacks.
On Fri, Oct 25, 2013 at 12:40 PM, Gunnar Morling <gunnar(a)hibernate.org>wrote:
> Hi Davide,
>
> I'm wondering why instead of creating Neo4jJtaPlatform we don't provide
> the TransactionManager as retrieved from ORM's JtaPlatform to Neo4j (as we
> e.g. do for ISPN)? I find the isNeo4j() code in ogm-core a bit
> discomforting.
>
Neo4j seems to allow for this via the TransactionManagerProvider SPI.
> Unfortunately one isn't in control of instantiating such providers,
though.
> So one would have to do some hackery using a static variable, ThreadLocal
> or similar to pass in the JtaPlatform. WDYT, would that make sense?
>
> --Gunnar
>
>
>
>
> 2013/3/13 Davide D'Alto <daltodavide(a)gmail.com>
>
>> Well...I don't have alternative at the moment.
>>
>> I think we could keep it as it is now and wait for some feedback from the
>> users.
>>
>> On Mon, Mar 4, 2013 at 1:17 PM, Emmanuel Bernard <emmanuel(a)hibernate.org>
>> wrote:
>> > Do you have an alternative in mind?
>> >
>> > My understanding is that if you write a Neo4J JtaPlatform, then the
>> > transaction will be started:
>> >
>> > - if the transaction is manually started by the wrapping code
>> > - if someone uses Session.beginTransaction() or
>> > EntityManager.getTransaction().begin()
>> >
>> > You wanted the Neo4J transaction to be started if @Transactional is
>> > added to a CDI bean? I'd say that's the job of the Neo4J team to
amke
>> > sure that one works, no?
>> >
>> > If we can find a better solution that would be nice but I'm not sure I
>> > understand the problem :)
>> >
>> > Emmanuel
>> >
>> > On Mon 2013-02-25 15:08, Davide D'Alto wrote:
>> >> Hi,
>> >> I'm working at the integration between OGM and Neo4j.
>> >>
>> >> Neo4j is fully transactional and it requires to open a transaction
>> >> before the execution of any operation on the DB.
>> >> To integrate this mechanism with OGM I've created the class
>> >> Neo4jJtaPlatform.java[1] that extends AbstractJtaPlatform and it's
>> >> registered using the configuration parameter
>> >> hibernate.transaction.jta.platform
>> >> If I'm correct, while this solution is working, it requires the
>> >> application to manage transactions using the Neo4j transaction
>> >> manager. Are there alternatives to this approach?
>> >>
>> >> The related pull request can be found at
>> >>
https://github.com/hibernate/hibernate-ogm/pull/132
>> >>
>> >> Thanks,
>> >> Davide
>> >>
>> >> [1]
>>
https://github.com/DavideD/hibernate-ogm/blob/2b6588998673bce8a9ccd973f69...
>> >> _______________________________________________
>> >> hibernate-dev mailing list
>> >> hibernate-dev(a)lists.jboss.org
>> >>
https://lists.jboss.org/mailman/listinfo/hibernate-dev
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>
>