You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Kalle Korhonen <ka...@gmail.com> on 2012/10/26 00:17:47 UTC

JPA 2.1, EntityListeners and CDI

Hey Igor & all, is anybody tracking the JPA 2.1 work and/or
integrating with the bleeding edge? I'd love to use injectable
EntityListeners, as is (in 2.0) they are pretty restrictive. Looks
like Tapestry will need to add a bit of support to make the CDI happen
once the spec's finalized.

Kalle

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: JPA 2.1, EntityListeners and CDI

Posted by Kalle Korhonen <ka...@gmail.com>.
On Mon, Oct 29, 2012 at 8:17 AM, Igor Drobiazko
<ig...@gmail.com> wrote:
> Hi Kalle,
> sure, why not? What exactly is needed?

I was hoping you would know :) The entity-listener currently takes a
class as a parameter:
<persistence-unit-metadata>
        <persistence-unit-defaults>
            <entity-listeners>
                <entity-listener
class="za.co.yellowfire.solarflare.jpa.SearchIndexListener">
                    <post-persist method-name="postPersist"  />
                    <post-remove method-name="postRemove"  />
                </entity-listener>
                <entity-listener
class="za.co.yellowfire.jpa.DomainEntityListener">
                    <pre-persist method-name="prePersist"  />
                    <pre-update method-name="preUpdate"  />
                </entity-listener>
            </entity-listeners>
        </persistence-unit-defaults>
</persistence-unit-metadata>

But in JPA 2.1 an entity listener can be a CDI injected instance (see
http://blog.ringerc.id.au/2012/06/jpa-21-will-support-cdi-injection-in.html).
What I don't know is what the configuration looks like. EclipseLink
2.5.0 will be JPA 2.1 compliant. It's still early for 2.5.0 (GA is
mid-2013) but the milestone releases will probably start supporting it
soon. For us, it's certainly easy to autobuild the listener but
there'd have to be something in the spec to hand it out to the JPA
provider. I'm currently doing the same in an implementation specific
way.

Kalle

>
> On Fri, Oct 26, 2012 at 12:17 AM, Kalle Korhonen <kalle.o.korhonen@gmail.com
>> wrote:
>
>> Hey Igor & all, is anybody tracking the JPA 2.1 work and/or
>> integrating with the bleeding edge? I'd love to use injectable
>> EntityListeners, as is (in 2.0) they are pretty restrictive. Looks
>> like Tapestry will need to add a bit of support to make the CDI happen
>> once the spec's finalized.
>>
>> Kalle
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: dev-help@tapestry.apache.org
>>
>>
>
>
> --
> Best regards,
>
> Igor Drobiazko
> http://tapestry5.de
> http://twitter.com/drobiazko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: JPA 2.1, EntityListeners and CDI

Posted by Igor Drobiazko <ig...@gmail.com>.
Hi Kalle,

sure, why not? What exactly is needed?

On Fri, Oct 26, 2012 at 12:17 AM, Kalle Korhonen <kalle.o.korhonen@gmail.com
> wrote:

> Hey Igor & all, is anybody tracking the JPA 2.1 work and/or
> integrating with the bleeding edge? I'd love to use injectable
> EntityListeners, as is (in 2.0) they are pretty restrictive. Looks
> like Tapestry will need to add a bit of support to make the CDI happen
> once the spec's finalized.
>
> Kalle
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de
http://twitter.com/drobiazko