You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by membersound <me...@web.de> on 2012/10/28 21:22:39 UTC
DAO is always null??
I created a DAO and inject it into my UserService. But whenever I access my
UserService, the dao is always null! Can someone spot what I might be doing
wrong?
interface CrudServiceDAO{}
class HibernateCrudServiceDAO implements CrudServiceDAO {
@Inject
Session session;
}
class AppModule {
public static void bind(ServiceBinder binder)
{
binder.bind(CrudServiceDAO.class, HibernateCrudServiceDAO.class);
}
}
class UserService {
@Inject
private CrudServiceDAO dao;
List<User> getUsers() {
//dao is always NULL!!
return dao.findAll();
}
}
--
View this message in context: http://tapestry.1045711.n5.nabble.com/DAO-is-always-null-tp5717355.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: DAO is always null??
Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Ha. Learn something new every day :)
On Oct 29, 2012, at 6:27 AM, "Thiago H de Paula Figueiredo" <th...@gmail.com> wrote:
> On Sun, 28 Oct 2012 19:08:23 -0200, Lenny Primak <lp...@hope.nyc.ny.us> wrote:
>
>> UserService must be a Tapestry service in a Tapestry-controlled package for @Inject to work. It probably isn't.
>
> Actually, Tapestry services can be in any package (except the default one, of course). There are no controlled pages for services. UserService must be a Tapestry service declared in a module class (AppModule, for example).
>
> --
> Thiago H. de Paula Figueiredo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: DAO is always null??
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Sun, 28 Oct 2012 19:08:23 -0200, Lenny Primak <lp...@hope.nyc.ny.us>
wrote:
> UserService must be a Tapestry service in a Tapestry-controlled package
> for @Inject to work. It probably isn't.
Actually, Tapestry services can be in any package (except the default one,
of course). There are no controlled pages for services. UserService must
be a Tapestry service declared in a module class (AppModule, for example).
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: DAO is always null??
Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
UserService must be a Tapestry service in a Tapestry-controlled package for @Inject to work
It probably isn't.
On Oct 28, 2012, at 4:22 PM, membersound <me...@web.de> wrote:
> I created a DAO and inject it into my UserService. But whenever I access my
> UserService, the dao is always null! Can someone spot what I might be doing
> wrong?
>
>
> interface CrudServiceDAO{}
>
> class HibernateCrudServiceDAO implements CrudServiceDAO {
> @Inject
> Session session;
> }
>
>
> class AppModule {
> public static void bind(ServiceBinder binder)
> {
> binder.bind(CrudServiceDAO.class, HibernateCrudServiceDAO.class);
> }
> }
>
>
> class UserService {
> @Inject
> private CrudServiceDAO dao;
>
> List<User> getUsers() {
> //dao is always NULL!!
> return dao.findAll();
> }
> }
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/DAO-is-always-null-tp5717355.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org