The goal of the POLYFORMS project is to eliminate duplicate code for binding data access objects and the underlying persistence APIs. The approach to this framework is to automate the implementation of service methods on repository interfaces defined by developers. The method defined in the interface is connected to the database operation by default through a naming convention. For example, the project Wiki discusses how to implement a storage for the user entity object. First, the stored APIs must be defined as:
 
public interface UserRepository extends EntityRepository<User, String> {
 
   @Finder
   List<User> findByCreator(User creator);
 }
 
@Finder Annotations mark the Polyforms method. Next, do not implement Userrepostiory, but provide a matching hibernate query in the user entity with additional annotations.
 
@NamedQueries({
   @NamedQuery(name = "User.findByCreator", query = "select u from User u where u.creator = :creator"),
 })
 public class User {
  ...
 }
 
According to the document, the naming convention used to find query statements is based on the method name and the entity name:
 
The mapping rule for a named query is [name of Named query] = [name of Entity]. [Name of method]. You can specify the name of the named query by @finder, such as @finder ("Finduserbyname"), and then the name of the query will be "User.finduserbyname".
 
In addition to @finder annotations, there are @updater and @counter that provide support for large-scale updates and query counts, respectively.
 
Entityrepository
 
The parent interface already supports the ability to save a single entity, delete, and get through identifiers.
 
All of these connections are through
 
Spring Framework
 
Completed, and relies on spring's slice to provide dynamic implementation of the API.
 
Other features supported by Polyforms include:
 
Automatic management of trace information (creator, creation date, modifier, modified date)
 
Transparent paging support
 
Defining transaction boundaries through annotations
 
Domain event model, separating persistent events and application functionality.