I have several questions which I would very much appreciate some help with. Thanks in advance.
1.I am planning to use Hibernate Sessions that span several transactions to complete a business process. If a Hibernate proxy is obtained within a transaction, can it be initialized outside of the transaction, but within the same Session (after disconnecting from the session)?
2.I have defined an inheritance hierarchy of Person -> Contact -> User, where Person is the base class and both Contact and User are concrete classes. I want to use the 2nd level cache for User objects, as they are referenced frequently and is ok without the latest version. From my quick read of net.sf.hibernate.mapping.Subclass, it appears that it is not possible to use the 2nd level cache for a subclass if the base class does not also use the 2nd level cache. So for example, I am led to believe that I would not be able to use the 2nd level cache for User if I did not also use it for Person and Contact.
Is this correct? If so, it would seem to break my intended use of 2nd-level caching, which is to cache Users, but not non-User Contacts in the 2nd level cache. If this is true, I'm thinking of making User a base class and creating a bidirectional reference between it and Contact, but that causes another problem for my design because some attributes of Person are needed for the most basic use of User, i.e. a list of UserS in which the first and last names are displayed (which are attributes of Person in my model). A hack to deal with that would be to store the fields needed to display a list of User objects in the User object/table, but I'd like to avoid so ugly a solution. Suggestions?
3.If I use a 2nd level cache (using ehCache) with usage=
|