Results 1 to 7 of 7

Thread: Possible to inject objects into Hibernate UserType?

  1. #1

    Default Possible to inject objects into Hibernate UserType?

    Hello,

    I have implemented a Label user type which I use for internationalization. In the UserType I need to do a lookup in the database using the LabelDAO. I had this working using Spring 1.2 and using the DependencyInjectionInterceptor from the Spring sandbox where I would inject the DAO into the Label domain object and had static methods in there which the UserType could access. However, I'm in the process of upgrading to Spring 2.0.

    How can I either accomplish this using Spring 2.0 (since I can no longer use the DIInterceptor) or is anyone else doing the same thing and would like to share how they do it?

    Thanks for any help,

    Rexxe

  2. #2
    Join Date
    Dec 2005
    Posts
    269

    Default

    I would use a simple interceptor around the getLabel() of your domain object.

  3. #3
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Have you looked at @Configurable?
    http://www.springframework.org/docs/...atconfigurable

  4. #4

    Default

    Quote Originally Posted by karldmoore View Post
    Yeah, I looked at that, but was unable to get it to work. I followed the steps in the ref manual, but the DAO still comes out null. I am a bit confused on the compiling aspects part. I'm not sure what I need to compile since I don't have any aspects. Any insight as to how to do this?

    Thanks!

  5. #5
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    There are lots of articles out there that discuss @Configurable, might be worth googling and having a read.
    e.g.
    http://www.aspectprogrammer.org/blog...cal_gui_2.html

  6. #6

    Default

    Quote Originally Posted by karldmoore View Post
    There are lots of articles out there that discuss @Configurable, might be worth googling and having a read.
    e.g.
    http://www.aspectprogrammer.org/blog...cal_gui_2.html
    Cool, thanks for the link.....I'll check it out.

  7. #7
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Not a problem, hope it helps. There were plenty out there when I searched. If that one doesn't help, I'm sure you can find one that will.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •