Announcement Announcement Module
Collapse
No announcement yet.
Possible to inject objects into Hibernate UserType? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    I would use a simple interceptor around the getLabel() of your domain object.

    Comment


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

      Comment


      • #4
        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!

        Comment


        • #5
          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

          Comment


          • #6
            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.

            Comment


            • #7
              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.

              Comment

              Working...
              X