Hi!
Something like this:
public static void disposeEntityManagers() {
try {
// The write-transaction is either rolled back or committed.
getEntityWriter().close();
} finally {
entityWriterHandle.remove();
if (!TransactionWrapper.isOverrideDuringTests()) {
try {
try {
getEntityReader().clear();
} finally {
getEntityReader().close();
}
} finally {
entityReaderHandle.remove();
}
}
}
}
**
Martin
2008/8/8 HITECH79 <[EMAIL PROTECTED]>:
>
> Hallo Martin,
>
> thanks a lot for your answers.... Could i see the content of this method
> "EntityManagerUtils.disposeEntityManagers()"
>
> Greetings
>
>
>
>
>
>
> Martin Makundi wrote:
>>
>> Hi!
>>
>> I am using this configuration (actually with Jetty, not Tomcat).
>>
>> 1. I have a persistence.xml with all the necessary setup (if you have
>> plain Hibernate, you have hibernate-cfg.xml).
>> 2. I have a EntityManagerUtil class for managing the connection (you
>> could have, e.g., HibernateUtil or something).
>> 3. I use lazy initialization for the Hibernate, i.e., every time I
>> heed the connection I initialize it if it is not yet initialized
>> (think: "singleton").
>> 4. I have tweaked the Wicket RequestCycle for closing the possibly
>> lazily opened connections; in my XXWebApplication.java:
>>
>> @Override
>> public RequestCycle newRequestCycle(Request request, Response response)
>> {
>> return new WebRequestCycle(this, (WebRequest)request,
>> (WebResponse)response) {
>> /**
>> * @see org.apache.wicket.RequestCycle#onEndRequest()
>> */
>> @Override
>> protected void onEndRequest() {
>> try {
>> EntityManagerUtils.disposeEntityManagers();
>> } catch (Throwable t) {
>> Utils.errorLog(this.getClass(), t);
>> }
>> super.onEndRequest();
>> }
>> };
>> }
>>
>> **
>> Martin
>>
>>
>>
>> 2008/8/5 HITECH79 <[EMAIL PROTECTED]>:
>>>
>>> Hallo,
>>>
>>> i need help for a configuration or tutorial or example for a project with
>>> Wicket+Hibernate+Tomcat. Please no answers with interaction Spring or
>>> framework Databinder.
>>>
>>> Only Wicket+Hibernate+Tomcat :-)
>>>
>>> Thanks a lot
>>>
>>>
>>> Cheers...
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Wicket-%2B-Hibernate-without-Spring-and-Databinder-tp18827595p18827595.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Wicket-%2B-Hibernate-without-Spring-and-Databinder-tp18827595p18891644.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]