Ted,

I ran into this same problem. As far as I can tell, Hivetranse will not reuse a single hibernate Session across multiple transactions. Normally it will close the session after a transaction. If you use the DeferSessionClose option, it will keep the session around, but still create a new sessions for any subsequent transactions that are started. This leads to the hibernate exception you are seeing.

I couldn't figure out a good way to use Hivetranse to achieve 1) a single hibernate Session per request and 2) have tapestry directly update the persistent object during a form submission, 3) allow possible rollback possibly based on conditions in my listener method (such as validation) and 4) have SessionOpenInView for displaying lazily loaded objects.

I am currently using the approach in Chap 7 of Kent Tong's book, which creates a single Session per thread (hence request), automatically commits any open transaction at the end of the request (which is usually too late) but also allows manually ending the current transaction at any point (as a commit or rollback).

I still need to take the time to investigate Honeycomb to see if that is a better approach.

-- Mark R

Ted Steen wrote:
yes

On 4/22/06, Raul Raja <[EMAIL PROTECTED]> wrote:
Do you have the following in your hivemodule.xml?

<contribution configuration-id="hivemind.ApplicationDefaults">
  <default symbol="hivetranse.hibernate.DeferSessionClose" value="true"/>
</contribution>

Ted Steen wrote:
Hi.

This is a subset of my hivemodule.xml

      <service-point id="HibernateSession" interface="org.hibernate.Session">
              <invoke-factory service-id="hivetranse.hibernate3.SessionFactory"
model="singleton">
                      <config configuration-id="HibernateConfig" />
              </invoke-factory>
      </service-point>

      <!-- Set up infrastructure:session as an alias for service:Session -->
    <contribution configuration-id="tapestry.Infrastructure">
        <property name="hibernateSession" object="service:HibernateSession"/>
    </contribution>


    <service-point id="UserAccess" interface="IUserAccess">
        <invoke-factory>
            <construct class="UserAccess">
                <set-object property="session"
value="infrastructure:hibernateSession" />
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="EntryAccess" interface="IEntryAccess">
        <invoke-factory>
            <construct class="EntryAccess">
                <set-object property="session"
value="infrastructure:hibernateSession" />
            </construct>
        </invoke-factory>
    </service-point>

Now, my question is, will all my dao objects share the same hibernateSession?
I get org.hibernate.HibernateException: Illegal attempt to associate a
collection with two open sessions
and I suspect I get it because I have different sessions in my dao objects. :/

Thanks,
/ted

---------------------------------------------------------------------
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]




--
/ted

---------------------------------------------------------------------
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]

Reply via email to