java - How to comment (javadoc) NamedQueries -


assume there named queries in entity, how should named queries commented? there way map them created javadoc?

  @entity     @namedqueries({         @namedquery(name="country.findall",                     query="select c country c"),         @namedquery(name="country.findbyname",                     query="select c country c c.name = :name"),     })      public class country {       ...     } 

at moment put comments (non javadoc) in line before don't much.

// find countries @namedquery(name="country.findall", query="select c country c") 

i use define query's name constant inside of entity class. constant can of course commented:

@entity @namedqueries({ @namedquery(name=country.query_find_by_name,             query="select c country c c.name = :name"), })  public class country {      /**      * description of query. bla bla.      */     public static final string query_find_by_name = "country.findbyname";     ... } 

as bonus, can use constant instead of string when creating named query:

em.createnamedquery(country.query_find_by_name, country.class); 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -