Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
User Journal

FortKnox's Journal: [Java] Pointcuts and Advisors... 5

Journal by FortKnox
The project I'm architecting is using EJB3 with Hibernate3 and spring2. Been loads of fun, as I was permitted to use Java5[1], so I'm annotating the crap out of stuff (Adding "@Transactional" above a method with all the params instead of in the app-context.xml is not only convient, but makes for easier reading of code!).
Today I needed an interceptor, but you can't have an annotated driven transaction manager with interceptors, so I had to do a quick AOP learning session, and made a pointcut and advisor to do my dirty work.
The interceptor will intercept any service call and catches the hibernate exceptions, wrapping them into a nice version of the exception. Unfortunately, due to all the if-then-else, I'm tempted to make a visitor pattern, but it'll be a pain in the rear to have to imp each type of exception visit for every service.... I'll have to figure out a better way...
Anyway, the whole aspect thang I can see as extremely powerful. Being able to register in interceptors to deal with the before and after happenings of methods. But I also can see a lot of developers seriously shooting themselves in the foot with that type of behavior. Anyone else done any type of AOP?


[1]: As for the other features of 5 that I've used? Generics are essential and make life so easy. For-each loops, though, I've not had much success with. There are too many times you want to check a 'iterator.hasNext()' which isn't available with for-each loops...
This discussion has been archived. No new comments can be posted.

[Java] Pointcuts and Advisors...

Comments Filter:
  • And what's sad is that just 3 years ago I was migrating from our proprietary middle ware to using JMS queues and publishes, and fitting in some database ejbs to handle transactions with our computational software.

    /Can't believe it took java this long to get enumerations

    • by FortKnox (169099) *
      Sorry... working so much that its tough to get my mind out into a JE and for it to be coherent. I'll probably try again on my vacation. Was just happy to get AOP advisors working in spring... just made my own annotation (which was mindlessly easy to do). Its rare for me to be in charge of the new tech and getting things working, and, I have to say, its incredibly fun!
      • by mekkab (133181)
        And that's absolutely fine... infact, this SHOULD be an apropriate place where you can brain dump things you've figured out and share those "eureka!" moments with people who understand...

        'cept that I don't understand ; )

        /If you want, I could rattle on about abstract tagged limited private types
        //But that's no fun for anyone
  • I am in the process of an almost identical development environment. Been learning about annotations this week. I'm workign on adding javadocs to all our new java5 goodness. Fun stuff. Confusing, but fun.

    jason
  • Java5 rocks, sorry you didn't get to use it sooner. Now that I am used to Generics, using previous versions of Java is painful.

    Second: I need your email address! You led me onto this linkedin thingy but it won't let me bug you without an email address, apparently AIM addresses don't do! Drop me a line at devlin.bentley@gmail.com or com2kid@gmail.com or com2kid on any IM network or com2kid at just about anything else .com :) (Actually I no longer check my 4 or 5 other com2kid@yyyyy.com addresses, so use

BASIC is to computer programming as QWERTY is to typing. -- Seymour Papert

Working...