Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] Compass Interatino with Eclipse Link

Hi,

   First, I wanted to share with you the fact that Compass now integrates
with EclipseLink. Aside from its generic support for EclipseLink, it also
support "Embedded EclipseLink", have a look here:
http://www.opensymphony.com/compass/versions/2.0M1-SNAPSHOT/html/gps-embeddedeclipselink.html

   With the embedded support I had to hack around several places that I wish
would be nicer. So, I am asking if what I did and what I purpose make sense.
The integration itself uses EclipseLink support for SessionCustomizer where
I can get a hold of the Session and then Configure Compass with it. This is
the best "embedded" integration point that I could find. Doing so, I found a
few problems that I would like to solve better:

1. I need to get a hold of the properties defined within the persistence.xml
file in order to read Compass configuration properties.
Session#getProeprties() only returns properties passed programatically. Is
there a chance to add Session#getMergedProperties() to return all of them?

2. I need to know if the transaction type is JTA or RESOURCE_LOCAL so I can
configure Compass with the correct transaction mechanism.

1 and 2 were solved by using the
EntityManagerFactoryProvider#getEntityManagerSetupImpl, and based on
knowledge of how a session name is constructed to extract the persistence
unit name :). Not nice, and won't work when a custom session name will be
provided.

3. I add a SessionEventListener in order to hook into transaction lifecycle
methods. It would be nice if there was an onClose event where I can also
shutdown Compass correctly. Currently, I am doing it in the finalize method
(not nice at all). Is there another way to know that a session was closed?

Last, it would be great if you had, in the same manner that you have
JpaEntityManager, also a JpaEntityManagerFactory interface, which at least
returns the ServerSession. This way, I can work with it without resulting
into openning and closing an EntityManager, and also be able to work in
environments where the EntityManagerFactory is proxied.

Another last, though a bigger change. The best thing for the integration
would be the ability to store custom "attributes" on both the
EntityManagerFactory and EntityManager. This will allow me to associate a
Compass instance with the EMF and a CompassSession with the EM without
resulting into instnaceof checks of event listeners. This would make the
integration so much nicer... .

What say you?

Cheers,
Shay Banon
-- 
View this message in context: http://www.nabble.com/Compass-Interatino-with-Eclipse-Link-tp14974470p14974470.html
Sent from the EclipseLink - Dev mailing list archive at Nabble.com.



Back to the top