There is a lot of info out there on Tapestry Injection...perhaps too much. ;) I'm having trouble with what I believe to be something fairly simple - the answer just evades me...
Here is a simplified view of the classes I'm trying to get to work together: NewUserPage.java (Tapestry Page backing up the similarly named NewUserPage.tml) User.java (Hibernate Entity - business logic goes here) UserDao.java (Data Access Object - this is where the HQL will be) Ok, I understand how I can inject the Session from within the NewUserPage - it is a Component and is injection aware. Registering the UserDao as a service and injecting it in the page and then having the page do a bunch of DAO operations on the Entity seems to be what most examples I've seen do. The problem is that I'm stubborn and don't want my 'view' (page) accessing the DAO directly and prefer it to only interact with the business object layer. Below is an example of what I'm trying to do. Its goal is to verify a username doesn't already exist when a new user is creating an account. NewUserPage.java: @Property private User newUser; public void onValidate() { if(newUser.exists()) { form.recordError("Username exists. Please choose another."); } } User.java: private IUserDao dao = new UserDao(); public boolean exists() { User existingUser = dao.findByUsername(getUsername()); return existingUser != null; } UserDao.java: public class UserDao implements IUserDao { @InjectService("Session") Session session; public User findByUsername(String username) { Query query = session.createQuery("from User where LOWER(username)=LOWER(:username)"); ... return user; } } The problem is that @InjectService("Session") in UserDao doesn't seem to do anything. I've tried various permutations of @Inject, @InjectService, and messing around in AppModule, but the session is always null when it goes to use it to createQuery. Is the fundamental design of View->BusinessObject->DAO deprecated and needs to be adjusted for the IoC world of Tapestry? Hopefully I'm just missing something simple and the example above can work. Thanks for any insights you may have! -- View this message in context: http://tapestry.1045711.n5.nabble.com/Injecting-Session-into-DAO-tp5713703.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org