It might sound strange in theory, but in the project I'm working on, we support authentication against external user tables by creating a view in the external database that conforms to our schema. Thus tables in our schema end up with a logical reference to the user table in the external database.
I am looking for a strategy to hide (from the DAO developer) the fact that loading the objects involves using two hibernate sessions. Conceptually, I would expect to take control over a proxy and load the related object using a different session. Assuming the mapping below, I would like to be able to simply write
Code:
computerSession.getAppUser()
and handle the details of using a second session in some (custom) proxy code. Is this possible?
Hibernate version: 2.1.6
Mapping documents:
<hibernate-mapping>
<class
name="com.knoa.server.data.ComputerSession"
table=
"COMPUTER_SESSION"
dynamic-update="false"
dynamic-insert="false"
>
...
<many-to-one
name="appUser"
class="com.knoa.server.data.AppUser"
cascade="none"
outer-join="false"
update="true"
insert="true"
access="property"
>
<column
name=
"APP_USER_ID"
/>
</many-to-one>
---
</class>
<class
name="com.knoa.server.data.AppUser"
table=
"APP_USER"
dynamic-update="false"
dynamic-insert="false"
>
...
</class>
Code between sessionFactory.openSession() and session.close(): Not relevant
Full stack trace of any exception that occurs: No exception
Name and version of the database you are using: MSSQL 2000 (Not relevant)
The generated SQL (show_sql=true): No SQL
Debug level Hibernate log excerpt: Not relevant