Basically that's the case I'm referring to

@Repository
@EntityManagerConfig( ... )
public abstract class SimpleRepository extends
AbstractEntityRepository<Simple, Long> {

    @Transactional
    public List<Simple> findByName(String name)  {
        String query = "select s from Simple s where s.name = :name";
        return entityManager().createQuery(query, Simple.class)
.setParameter("name", name)
                .setLockMode(READ) // needs a tx
                .getResultList();
    }
    ...

currently this triggers neither the InvocationHandler nor the interceptor
(and if it does then the interceptor should deal with @EntityManagerConfig).

Another pragmatic variant could be to add something like that to
AbstractEntityRepository:
public abstract V transactional(Callable<V> callable)
which would then run again in the InvocationHandler, but seems like a
rather clunky workaround compared to the version above.


On Thu, Feb 20, 2014 at 4:45 PM, Romain Manni-Bucau
<rmannibu...@gmail.com>wrote:

> it is since you use the handled (interface for instance) as metadata, no?
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2014-02-20 16:32 GMT+01:00 Thomas Hug <thomas....@gmail.com>:
> > The more conceptual issue in this concrete case is that @Transactional
> > isn't really independent from the handler class (namely EntityManager
> > resolution). But I guess that's something we can deal with.
> >
> > So given the release time frame - anything we can do here or shall we
> park
> > this case for now?
> >
> >
> >
> > On Thu, Feb 20, 2014 at 2:17 PM, Romain Manni-Bucau
> > <rmannibu...@gmail.com>wrote:
> >
> >> I think so too
> >>
> >> Romain Manni-Bucau
> >> Twitter: @rmannibucau
> >> Blog: http://rmannibucau.wordpress.com/
> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> Github: https://github.com/rmannibucau
> >>
> >>
> >>
> >> 2014-02-20 13:05 GMT+01:00 Gerhard Petracek <gerhard.petra...@gmail.com
> >:
> >> > imo we "just" need to support interceptors.
> >> >
> >> > regards,
> >> > gerhard
> >> >
> >> >
> >> >
> >> > 2014-02-20 12:20 GMT+01:00 Thomas Hug <thomas....@gmail.com>:
> >> >
> >> >> While looking at transactional repositories, I realized that
> >> PartialBeans
> >> >> invoke concrete methods directly. That doesn't give the invocation
> >> handler
> >> >> a chance to hook into the call (and in the data case to control the
> tx).
> >> >>
> >> >> What about creating an additional handler interface which also
> allows to
> >> >> pass in the proceeding method? Or is there a better alternative?
> >> >>
> >>
>

Reply via email to