Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-339

Get rid of Active Record pattern and use Repository & Criteria pattern instead

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.0.0.RC2
    • 1.0.0.RC3
    • PERSISTENCE
    • None

    Description

      Get rid of Active Record pattern and use Repository & Criteria pattern instead
      Active Record pattern is not useful in big projects because entities have dependencies on persistence. It's likely that these entities will be serializable or even can be stored in different stores - DB, XML, JMS. Using of ActiveRecord pattern create a lot of unnecessary code and make entities not serializable and dependent only on DB store.
      I do propose to use Repository pattern instead of ActiveRecord. This will dramatically reduce number of generated code. Make entities independent from DB specific.
      Using Criteria pattern eliminate necessity to create finders in entities or on DAO layer.
      As result repository will looks like:

      public interface Repository<T extends Entity>

      { T create(T obj); T update(T obj); T read(Serializable key); void delete(Serializable key); List<T> load(IFilter filter); }

      Where Filter is tree of Criterias

      Attachments

        Issue Links

          Activity

            People

              balex Ben Alex
              alex.makarevitch Alexander Makarevitch
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: