RE: Tapestry & hibernate session - without tapestry-hibernate module
Mr. Wulf (shit this sounds cool!)
i didn't even know this could be done! but there is a questions that comes
to mind:
can injected objects be built on demand (runtime) or is it only once per
application session? once per
Mr. Wulf (shit this sounds cool!)
i didn't even know this could be done! but there is a questions that comes
to mind:
can injected objects be built on demand (runtime) or is it only once per
application session? once per thread basically.
you see, there is a reason why I decided to remove tapestr
Hi,
The awesome thing is that everything in Tapestry can be a service! All you need
is a service builder method and the @Inject annotation in your Services, Pages
and Components.
So for a hibernate session you could (not saying this is a good solution, but
it's a start) a service builder meth
https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;a=blob;f=tapestry-hibernate-core/src/main/java/org/apache/tapestry5/hibernate/HibernateCoreModule.java
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Tapestry-hibernate-session-without-tapestry-hibernate-module-tp5
Download the source code for tapestry-hibernate and take a look at how it
works. The session will end up being a proxy to a per-thread value. If you
want two different db connections, you might want to consider giving each
session a marker annotation to differentiate them.
--
View this message i
One possible solution would be to create a HibernateUtils class for example
to hold a session object. I could then persist that object on application
state lavel like this:
class HibernateUtils {
...
@Persist(PersistenceConstants.SESSION)
private Session session = ...
...
}
is this a way to go? i