Announcement Announcement Module
Collapse
No announcement yet.
Annotation driven row mapping? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Annotation driven row mapping?

    Has there been any discussion about using annotations to reduce the verbosity of managing row mappers?

    So that for example,

    Code:
    @RowMapper(name = fooMapper)
    private Foo mapRow(ResultSet rs, int rowNum)();
    is equivalent to

    Code:
    private ParameterizedRowMapper<Foo> fooMapper = new ParameterizedRowMapper<Foo>(){}
    It's something that would be nice to have so that my DAO test code (which uses Spring's Transactional Context Tests will not have about half a dozen inner classes (some about 3 deep) for unwinding my object tree.

  • #2
    Seconded. I have the same problem, some DAO classes were unmanagable due to the mappers etc they contain, I have now moved almost all mappers to seperate classes in a seperate package to reduce code clutter. The annotated way would help clean up code so much.

    Comment


    • #3
      Looks like hibernate does something similar:
      Code:
      @org.hibernate.annotations.MapKey( columns = { @Column( name="my_enum" ) } )

      Comment


      • #4
        Originally posted by tunaranch View Post
        Looks like hibernate does something similar:
        Code:
        @org.hibernate.annotations.MapKey( columns = { @Column( name="my_enum" ) } )
        As much as I may approve of hibernate, there are some cases where you just can't use it. Escpecially those where you are 'asked' not too. There is little someone like me can do about it. In such cases I have to rely on Jdbc DAO's for my data access.

        Comment


        • #5
          Not advocating the use of Hibernate. Merely illustrating how the annotation makes the code look simpler.

          Comment

          Working...
          X