Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » aspectj
aspectj [message #382797] Thu, 30 October 2008 22:06 Go to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 817
Registered: July 2009
Senior Member
Is it possible to use Eclipselink weaving in combination with AspectJ weaving? EclipseLink would perform its magic on the actual instance variables, AspectJ would focus on the methods (setters and getters).

Are there conflicts because both use agents (AFAIK)? Or should I used postcompilation on one or both?

Tom
Re: aspectj [message #382804 is a reply to message #382797] Wed, 05 November 2008 11:10 Go to previous messageGo to next message
Doug Clarke is currently offline Doug ClarkeFriend
Messages: 155
Registered: July 2009
Senior Member
Tom,

I see nobody has jumped on this question. I believe the answer depends on
what you are doing with AspectJ and will basically involve you testing it
out. EclipseLink can weave for field or property access based on your JPA
configuration.

Ultimately if you cannot make these work together you may be able to have
AspectJ do all of what our weaving does including what you need. If you
look into our weaving classes you'll see that each shows the corresponding
methods and attributes its adding to the entity class.

Doug
Re: aspectj [message #382805 is a reply to message #382804] Wed, 05 November 2008 15:46 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 817
Registered: July 2009
Senior Member
Ok. Well, I'll give it a spin when I have some time to spare. Indeed I hope that the separation between EclipseLink (fields) and AspectJ (methods) will work.

Tom
Re: aspectj [message #383010 is a reply to message #382805] Wed, 05 November 2008 21:14 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 817
Registered: July 2009
Senior Member
That didn't hurt much and yes, it does work! Great!
Re: aspectj [message #505047 is a reply to message #382797] Fri, 25 December 2009 11:02 Go to previous messageGo to next message
Christopher G. Stach II is currently offline Christopher G. Stach IIFriend
Messages: 8
Registered: July 2009
Junior Member
I would have created a new thread, but this is basically the same thing that I am trying to accomplish. I have Tomcat running a Spring 3.0.0 context with load time weaving (via AspectJ 1.6.6) to handle all of the JPA, etc. stuff. The issues that I am having may or may
not be that I need to disable EclipseLink (2.0.0) weaving. If I disable weaving and caching eclipselink.weaving=false and eclipselink.cache.type.default=NONE), things are okay. If I enable any sort of caching, with or without modified identity cache/session cache shared/whatever settings, it fails.

I have most of my unit tests passing, but a lot of them fail. They are related to collections updates and what looks like a session having more than one entity registered in itself (for whatever reason),, but it shows what would be the DB updates removing the entities..

Despite all of this, I have been working on an AspectJ version of the weaving so that EL can do its job. I've of course run into a lot of issues, particularly with the dubious declarations of specific entity fields, but we'll see...
Re: aspectj [message #505048 is a reply to message #382797] Fri, 25 December 2009 11:04 Go to previous messageGo to next message
Christopher G. Stach II is currently offline Christopher G. Stach IIFriend
Messages: 8
Registered: July 2009
Junior Member
(Why does everyone in the thread appear as registering from the same date?) Razz
Re: aspectj [message #505963 is a reply to message #505047] Tue, 05 January 2010 16:31 Go to previous messageGo to next message
Shaun Smith is currently offline Shaun SmithFriend
Messages: 197
Registered: July 2009
Senior Member
Exactly what problems are you seeing? EclipseLink weaving in Tomcat with Spring should work as long as you've followed the instructions in the Spring docs.

BTW a cache type of NONE is probably not what you want. To disable shared (L2) caching of Entities you should set "shared" to false either globally or on individual Entities [1].

Are you working on an alternate weaving implementation for EclipseLink using AspectJ? I wasn't aware AspectJ offered a runtime API that would support this.

--Shaun

[1] http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#How_to_Use_the_.40Cache_Annotation
Re: aspectj [message #509937 is a reply to message #505963] Mon, 25 January 2010 19:58 Go to previous messageGo to next message
Christopher G. Stach II is currently offline Christopher G. Stach IIFriend
Messages: 8
Registered: July 2009
Junior Member
It doesn't work alongside AspectJ, it seems. Some exceptions:

java.lang.NullPointerException
	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getMethodReturnType(PrivilegedAccessHelper.java:302)
	at org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor.getGetMethodReturnType(MethodAttributeAccessor.java:105)
	at org.eclipse.persistence.mappings.ForeignReferenceMapping.validateBeforeInitialization(ForeignReferenceMapping.java:1505)
	at org.eclipse.persistence.descriptors.ClassDescriptor.validateBeforeInitialization(ClassDescriptor.java:5260)
	at org.eclipse.persistence.descriptors.ClassDescriptor.preInitialize(ClassDescriptor.java:3323)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:429)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:406)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:671)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:633)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:230)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:368)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:151)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:207)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:195)


Internal Exception: java.lang.NoSuchMethodException: com.xxx.model.Xxx._persistence_getxxx_vh()
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[xxx]
Descriptor: RelationalDescriptor(com.xxx.model.Xxx --> [DatabaseTable(xxx)])


You're right about the cache type. I don't want that, but that's the only way my persistence tests work. If any caching is broken, then there won't be any getting deployed. I am certainly not going to work around it if consistency is at risk. I have to write up a simplified test case one of these days when things calm down.

I have a large portion of the advice that EL applies done with AspectJ. Some of what EL does, like dynamic method names, definitely can't be handled the same way. I do have an alternative implementation for some of that, though. I wish that part of EL was documented.
Re: aspectj [message #509994 is a reply to message #382797] Tue, 26 January 2010 03:33 Go to previous message
Christopher G. Stach II is currently offline Christopher G. Stach IIFriend
Messages: 8
Registered: July 2009
Junior Member
One thing I should state about the caching problem I have (a remove not cascading) is that things work fine if I use isolated client sessions, but that's still kind of off topic.
Previous Topic:eclipselink 2.0 and weblogic 10.3.2 integration
Next Topic:Howto call nontransactional Call in JTA Environment?
Goto Forum:
  


Current Time: Wed Apr 24 22:13:25 GMT 2024

Powered by FUDForum. Page generated in 0.03414 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top