Hi Derek,
Derek Broughton wrote:
Appfuse 2.0, Struts basic, Postgres
I want to execute a Hibernate NamedQuery, but I can't figure out how to get
the hibernate Session from within my Action.
Can somebody point me to some useful documentation - every example I've
found assumes you already have the Session.
I think your problem is that you should be doing that in your DAO, not
your Action. I use a number of named queries in my app, within DAOs and
the session is just there (provided via getSession() by a superclass).
I'm no expert, but as I understand it, proper "separation of concerns"
means that you should do the DB stuff in your DAO (actually the
implementation, DaoHibernate), call the DAOs from your Manager which
applies any business logic and then call the manager from your Action
which is mostly involved with handling display and navigation. If
anyone who knows more about this than I do (most of you) can verify this
simple overview or correct it if any of it is wrong, I'd be pleased if
you would.
HTH,
Rob Hills
Waikiki, Western Australia
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]