Thanks for the reply Thiago.
I see what you mean, but then doing this requires me to create a new
ServiceBuilder instance for each entity. This can get pretty lengthy
with an application that has a lot of entities.
This is why I was looking for a way to automagically create a generic
DAO instance for each entity.
Any other ideas?
Obrigado,
Miguel
On 30.08.2012 18:27, Thiago H de Paula Figueiredo wrote:
On Thu, 30 Aug 2012 19:15:11 -0300, Miguel O. Carvajal
<tapes...@carvajalonline.com> wrote:
Hey all,
Hi!
I saw in the issue 2550
(https://issues.apache.org/jira/browse/TAPESTRY-2550) that
ServiceBuilder was created exactly for this purpose, but since I have
no way of determining the generic type (or other way of determining
what Hibernate/JPA entity I am working with) within the
ServiceBuilder implementation. I just don't see how this can be done
with ServiceBuilder.
ServiceBuilder is an interface, so you should create at least one
implementation for it. Pass the entity class in the constructor of
your ServiceBuilder implementation. Something like this (not
tested):
public class DaoBuilder implements DaoBuilder<Dao> {
final private Class entityClass;
public DaoBuilder(Class entityclass) {
this.entityClass = entityClass;
}
Dao buildService(ServiceResources resources) {
// use entityClass to create the Dao and return it.
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org