On Sat, 2009-01-03 at 16:02 +0100, Lukasz Lenart wrote:
> 2009/1/3 Wes Wannemacher <[email protected]>:
[snip]
> [... cut ...]
>
> This GenericHibernateDaoImpl has non-default constructor and use
> generics, maybe that's the problem. Anyway I found other solution,
> simplest, use full action class name for bean name and it rocks ;-)
>
> Thanks for suggestions!
Oh shoot, I think I remember that as a stopping point for me as well...
Most Generic DAO implementations usually get an instance of Class or
something passed into the constructor so that there can be runtime info
about the type... Heck, even the one I use does that -
@Transactional
public class GenericDaoJpaImpl<T extends Persistent<K>, K>
extends JpaDaoSupport
implements GenericDao<T, K> {
private Class<T> type;
public GenericDaoJpaImpl(Class<T> type ) {
this.type = type;
}
public T create(T newInstance) {
return getJpaTemplate().merge(newInstance);
}
...
But, at the same time, doing that means you can't use CGLIB b/c Spring
thinks it's the wrong thing to do ->
http://jira.springframework.org/browse/SPR-3150
In this case, @Transactional still works for me w/o CGLIB because I'm
implementing an interface that the factory uses (I think)...
-Wes
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]