As I mentioned previously, in a contributed applicationStateManager, I
am not able to do a session.createQuery as it returns null - the Query
object is null.
@Contribute(ApplicationStateManager.class)
public void contributeApplicationStateManager(
MappedConfiguration<Class, ApplicationStateContribution>
configuration, final Session session, final Logger logger) {
ApplicationStateCreator<UserInfo> userInfoCreator = new
ApplicationStateCreator<UserInfo>() {
public UserInfo create() {
Person p = (Person) session
.createQuery("from Person p where
p.userName='student1'")
.uniqueResult();
I have done some more experiments and made it work somehow, but in an
unexpected way.
I found out that:
- session.createQuery() - returns null, whatever the query
- session.get(Person.class, id) - works OK, which means the session and
the connection to the database is OK
After many trials, I managed to find a way to run a query
- either like this:
session.getSession().createQuery()
- or like this:
session.getSessionFactory().openSession()
Somehow I don't think that I am supposed to do that. Any ideas?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org